From 7119f4b03045b4d062765a5863553c16aff3663d Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Tue, 18 Jun 2019 17:40:09 -0700 Subject: [PATCH] doc/go1.13: add release notes for language changes Change-Id: I17b156e77f279e1387ad27ab0e41ae8f50c9a325 Reviewed-on: https://go-review.googlesource.com/c/go/+/182857 Reviewed-by: Ian Lance Taylor Reviewed-by: Austin Clements --- doc/go1.13.html | 62 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/doc/go1.13.html b/doc/go1.13.html index 0e3f9f915c..83536f1a5c 100644 --- a/doc/go1.13.html +++ b/doc/go1.13.html @@ -41,13 +41,69 @@ TODO

Changes to the language

-TODO + Per the number literal proposal, + Go 1.13 supports a more uniform and modernized set of number literal prefixes. +

    +
  • + Binary integer literals: + The prefix 0b or 0B indicates a binary integer literal + such as 0b1011. +
  • + +
  • + Octal integer literals: + The prefix 0o or 0O indicates an octal integer literal + such as 0o660. + The existing octal notation indicated by a leading 0 followed by + octal digits remains valid. +
  • + +
  • + Hexadecimal floating point literals: + The prefix 0x or 0X may now be used to express the mantissa of a + floating-point number in hexadecimal format such as 0x1.0p-1021. + A hexadecimal floating-point number must always have an exponent, written as the letter + p or P followed by an exponent in decimal. The exponent scales + the mantissa by 2 to the power of the exponent. +
  • + +
  • + Imaginary literals: + The imaginary suffix i may now be used with any (binary, decimal, hexadecimal) + integer or floating-point literal. +
  • + +
  • + Digit separators: + The digits of any number literal may now be separated (grouped) using underscores, such as + in 1_000_000, 0b_1010_0110, or 3.1415_9265. + An underscore may appear between any two digits or the literal prefix and the first digit. +
  • +

-

- TODO: https://golang.org/cl/158797: implement shifts by signed amounts +

+ Per the signed shift counts proposal + Go 1.13 removes the restriction that a shift count + must be unsigned. This change eliminates the need for many artificial uint conversions, + solely introduced to satisfy this (now removed) restriction of the << and >> operators.

+

+ These language changes were implemented by changes to the compiler, and corresponding internal changes to the library + packages go/scanner and + text/scanner (number literals), + and go/types (signed shift counts). +

+ +

+ If your code uses modules and your go.mod files specifies a language version, be sure + it is set to at least 1.13 to get access to these language changes. + You can do this by editing the go.mod file directly, or you can run + go mod edit -go=1.13. +

+ +

Ports