From: Russ Cox Date: Thu, 20 Aug 2009 17:22:52 +0000 (-0700) Subject: simplifications. X-Git-Tag: weekly.2009-11-06~820 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=16b95ba614b2bf0e5f26e50ce79766d8428e310c;p=gostls13.git simplifications. mark multifile section with TODO only because that is a bigger change. R=gri DELTA=45 (9 added, 22 deleted, 14 changed) OCL=33565 CL=33593 --- diff --git a/doc/go_spec.html b/doc/go_spec.html index 7f8501375b..df8f7b0a9a 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1251,8 +1251,7 @@ In addition to explicit blocks in the source code, there are implicit blocks:
  • Each if, for, and switch statement is considered to be in its own implicit block.
  • -
  • Each case or type case clause in a switch statement, - and each communication clause in a select statement +
  • Each clause in a switch or select statement acts as an implicit block.
  • @@ -1302,7 +1301,7 @@ Go is lexically scoped using blocks: and ends at the end of the innermost containing block.
  • The scope of a type identifier declared inside a function - begins immediately after the identifier in the TypeSpec + begins at the identifier in the TypeSpec and ends at the end of the innermost containing block.
  • @@ -1755,8 +1754,7 @@ A qualified identifier is an identifier qualified by a package name prefix.

    -QualifiedIdent = [ ( LocalPackageName | PackageName ) "." ] identifier .
    -LocalPackageName = identifier .
    +QualifiedIdent = [ PackageName "." ] identifier .
     PackageName = identifier .
     
    @@ -1765,21 +1763,11 @@ A qualified identifier accesses an identifier in a separate package. The identifier must be exported by that package, which means that it must begin with a Unicode upper case letter (§Exported identifiers).

    -

    -The LocalPackageName is that of the package in which the qualified identifier -appears and is only necessary to access names hidden by intervening declarations -of a package-level identifier. -

     Math.Sin
    -mypackage.hiddenName
    -mypackage.Math.Sin  // if Math is declared in an intervening scope
     
    -TODO: 6g does not implement LocalPackageName. Is this new? -Is it needed? -

    Composite literals

    @@ -3183,10 +3171,8 @@ if x > 0 {

    -An "if" statement may include a simple statement before the expression. -The scope of any variables declared by that statement -extends to the end of the "if" statement -and the variables are initialized once before the statement is entered. +The expression may be preceded by a simple statement, which +executes before the expression is evaluated.

    @@ -3255,11 +3241,8 @@ Otherwise control flows to the end of the "switch" statement.
     

    -A "switch" statement may include a simple statement before the -expression. -The scope of any variables declared by that statement -extends to the end of the "switch" statement -and the variables are initialized once before the statement is entered. +The expression may be preceded by a simple statement, which +executes before the expression is evaluated.

    @@ -3355,6 +3338,11 @@ there can be only one type per "case", and
     the "fallthrough" statement is not allowed.
     

    +

    +The type switch guard may be preceded by a simple statement, which +executes before the guard is evaluated. +

    +

    For statements

    @@ -3384,10 +3372,8 @@ for a < b { A "for" statement with a "for" clause is also controlled by its condition, but additionally it may specify an init and a post statement, such as an assignment, -an increment or decrement statement. The init statement (but not the post -statement) may also be a short variable declaration; the scope of the variables -it declares ends at the end of the statement -(§Declarations and scope rules). +an increment or decrement statement. The init statement may be a +short variable declaration, but the post statement must not.

    @@ -3562,8 +3548,6 @@ which single communication will execute.
     

    The receive case may declare a new variable using a short variable declaration (§Short variable declarations). -The scope of such variables continues to the end of the -respective case's statements.

    @@ -4057,11 +4041,10 @@ identifer will have the form p1.N.  If no name
     is provided in the import declaration, P will be the package
     name declared within the source files of the imported package.
     Finally, if the import declaration uses an explicit period
    -(.) for the package name, N will appear
    -in the package-level scope of the current file and the qualified name is
    -unnecessary and erroneous.  In this form, it is an error if the import introduces
    -a name conflict.
    +(.) for the package name, N will be declared
    +in the current file's file block and can be accessed without a qualifier.
     

    +

    In this table, assume we have compiled a package named math, which exports function Sin, and @@ -4079,6 +4062,10 @@ import . "lib/math" Sin

    Multi-file packages

    +

    +TODO: Update for whole-package compilation. +

    +

    If a package is constructed from multiple source files, all names at package-level scope, not just exported names, are visible to all the