diff --git a/doc/go_spec.html b/doc/go_spec.html index b75845372da..b129520180d 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -7794,40 +7794,32 @@ min(x, y, z) == min(min(x, y), z)

Allocation

- The built-in function new creates a new, initialized - variable and returns - a pointer to it. - - It accepts a single argument, which may be either an expression or a type. -

-

- If the argument expr is an expression of - type T, or an untyped constant expression - whose default type is T, - then new(expr) allocates a variable of - type T, initializes it to the value - of expr, and returns its address, a value of - type *T. -

-

- If the argument is a type T, then new(T) - allocates a variable initialized to - the zero value of type T. -

-

- For example, new(123) and new(int) each - return a pointer to a new variable of type int. - - The value of the first variable is 123, and the value - of the second is 0. +The built-in function new creates a new, initialized +variable and returns +a pointer to it. +It accepts a single argument, which may be either a type or an expression.

-
-new(T)
-
+

+If the argument is a type T, then new(T) +allocates a variable of type T initialized to its +zero value. +

-For instance +If the argument is an expression x, then new(x) +allocates a variable of the type of x initialized to the value of x. +If that value is an untyped constant, it is first implicitly converted +to its default type; +if it is an untyped boolean value, it is first implicitly converted to type bool. +The predeclared identifier nil cannot be used as an argument to new. +

+ +

+For example, new(int) and new(123) each +return a pointer to a new variable of type int. +The value of the first variable is 0, and the value +of the second is 123. Similarly

@@ -7836,13 +7828,12 @@ new(S)
 

-allocates storage for a variable of type S, +allocates a variable of type S, initializes it (a=0, b=0.0), and returns a value of type *S containing the address -of the location. +of the variable.

-

Handling panics

Two built-in functions, panic and recover,