From d88133137bcab6839d1f1cab0d4b9edb30381b41 Mon Sep 17 00:00:00 2001
From: Rob Pike int
type and
uint
types are 32 or 64 bits. Previous Go implementations made int
and uint
32 bits on all systems. Both the gc and gccgo implementations
-now make
-int
and uint
64 bits on 64-bit platforms such as AMD64/x86-64.
+now make
+int
and uint
64 bits on 64-bit platforms such as AMD64/x86-64.
Among other things, this enables the allocation of slices with
more than 2 billion elements on 64-bit platforms.
"\ud800"
in Go 1.0, but prints "\ufffd"
in Go 1.1.
+
+Surrogate-half Unicode values are now illegal in rune and string constants, so constants such as
+'\ud800'
and "\ud800"
are now rejected by the compilers.
+When written explicitly as UTF-8 encoded bytes,
+such strings can still be created, as in "\xed\xa0\x80"
.
+However, when such a string is decoded as a sequence of runes, as in a range loop, it will yield only utf8.RuneError
+values.
+
The Unicode byte order marks U+FFFE and U+FEFF, encoded in UTF-8, are now permitted as the first character of a Go source file. @@ -255,7 +264,39 @@ TODO introduction
-TODO
+The various routines to scan textual input in the
+bufio
+package,
+ReadBytes
,
+ReadString
+and particularly
+ReadLine
,
+are needlessly complex to use for simple purposes.
+In Go 1.1, a new type,
+Scanner
,
+has been added to make it easier to do simple tasks such as
+read the input as a sequence of lines or space-delimited words.
+It simplifies the problem by terminating the scan on problematic
+input such as pathologically long lines, and having a simple
+default: line-oriented input, with each line stripped of its terminator.
+Here is code to reproduce the input a line at a time:
+
+scanner := bufio.NewScanner(os.Stdin) +for scanner.Scan() { + fmt.Println(scanner.Text()) // Println will add back the final '\n' +} +if err := scanner.Err(); err != nil { + fmt.Fprintln(os.Stderr, "reading standard input:", err) +} ++ +
+Scanning behavior can be adjusted through a function to control subdividing the input
+(see the documentation for SplitFunc
),
+but for tough problems or the need to continue past errors, the older interface
+may still be required.
-TODO:
-reflect
: Select, ChanOf, MakeFunc, MapOf, SliceOf, Convert, Type.ConvertibleTo
+The reflect
package has several significant additions.
+It is now possible to run a select
statement using
+the reflect
package; see the description of
+Select
+and
+SelectCase
+for details.
+
+The new method
+Value.Convert
+(or
+Type.ConvertibleTo
)
+provides functionality to execute a Go conversion or type assertion operation
+on a
+Value
+(or test for its possibility).
+
+The new function
+MakeFunc
+creates a wrapper function to make it easier to call a function with existing
+Values
,
+doing the standard Go conversions among the arguments, for instance
+to pass an actual int
to a formal interface{}
.
+
+Finally, the new functions
+ChanOf
,
+MapOf
+and
+SliceOf
+construct new
+Types
+from existing types, for example to construct a the type []T
given
+only T
.
+
-- 2.50.0