On Monday, October 3, 2016 at 5:30:35 PM UTC+8, Axel Wagner wrote: > > The only difference between talking about "TypeDecl" and "TypeSpec" is, > that it distinguishes > > type ( > Foo int > Bar int > ) > > from > > type Foo int > type Bar int >
ok, it looks the misunderstanding comes I thought "type (Foo int; Bar int)" is a declaration group, which contains two declarations. But, instead, now in go spec, the definition of type declaration is container which contains many type specifications. In fact, I feel this is some weird, for the word "type specification" is seldom orally used in practice. > so I don't see how it helps and if anything it makes things more > confusing, because one type declaration can *actually* define multiple > types, whereas one type spec can only ever define exactly one type. By > talking about type declarations instead of type specs, you seem to imply > that those two would behave differently, which they don't. > > So not only do I consider it more confusing, it also is completely > incorrect; Foo and Bar in both cases are distinct types and should be > distinct types. However, in the former case, they are two named types that > originate in the same type declaration so according to your proposed > language they would be identical. > > Besides this, in fact, in the example you provide, >> https://play.golang.org/p/PmkcvdNQnx, >> there are two same (in texts) type declarations, they are both legal. > > > They are not the same, they are different. They are also in different type > specs. And if you where the insist to call the two type declarations the > same, then the type specs are "same" in exactly the same sense. > > And why does "the same type-decl" will imply "type (Foo int; Foo int)", >> but "the same type-spec" will not make the imply? > > > Because both Foo are in the same type declaration, but not in the same > type spec. If the type spec language would imply anything of the sorts, it > would be that you could define two types in the same type-spec, which is > clearly impossible. > > > On Mon, Oct 3, 2016 at 11:10 AM, T L <tapi...@gmail.com <javascript:>> > wrote: > >> >> >> On Monday, October 3, 2016 at 4:59:26 PM UTC+8, T L wrote: >>> >>> >>> >>> On Monday, October 3, 2016 at 2:42:30 PM UTC+8, Axel Wagner wrote: >>>> >>>> Which would imply that something like this >>>> type ( >>>> Foo int >>>> Foo int >>>> ) >>>> might be legal. I don't understand (and thusly disagree) why that would >>>> be in any sense "less confusing". >>>> >>> >>> >>> I confuse again. >>> >>> In your before comments, you interpretate "the same type-spec" must be >>> the only occurrence of a type-spec, and can't be two occurrences of >>> same type-spec in texts. >>> But now you interpretate "the same type-decl" can be two occurrences of >>> same type-decl in texts. >>> >>> I really don't know my English understanding is right or not, now, again. >>> >> >> Besides this, in fact, in the example you provide, >> https://play.golang.org/p/PmkcvdNQnx, >> there are two same (in texts) type declarations, they are both legal. >> >> And why does "the same type-decl" will imply "type (Foo int; Foo int)", >> but "the same type-spec" will not make the imply? >> >> >>> >>> >>> >>>> >>>> On Mon, Oct 3, 2016 at 7:26 AM, T L <tapi...@gmail.com> wrote: >>>> >>>>> >>>>> >>>>> On Monday, October 3, 2016 at 1:52:10 AM UTC+8, Marvin Renich wrote: >>>>>> >>>>>> * Matt Harden <matt....@gmail.com> [161001 23:34]: >>>>>> > I do think that T L has a point. The spec defines the syntax of the >>>>>> > language, and TypeSpec refers to a syntactical construct. It is not >>>>>> > possible in the syntax of the language to create two named types >>>>>> that >>>>>> > originate in the same TypeSpec. We seem to be saying that uint8 and >>>>>> byte >>>>>> > originate in the same "TypeSpec", but the "TypeSpec" referred to >>>>>> there is >>>>>> > an implementation detail of the compiler, not the syntactical >>>>>> construct >>>>>> > defined in the Language Specification. >>>>>> >>>>>> Does anyone remember if there was a time when TypeSpec was defined as >>>>>> >>>>>> TypeSpec = IdentifierList Type . >>>>>> >>>>>> instead of the current >>>>>> >>>>>> TypeSpec = identifier Type . >>>>>> >>>>>> This would give a clear reason why the wording under type identity is >>>>>> the way it is. I don't remember such a definition, and I've been >>>>>> following Go since before Version 1, but not since the beginning, so >>>>>> this is at least conceivable. It's also possible that the Go authors >>>>>> were considering such a definition, and part of the spec was written, >>>>>> but the idea was thrown out as unnecessary and adding extra >>>>>> complexity, >>>>>> accidentally leaving an artifact of a considered, but discarded, >>>>>> design >>>>>> detail. >>>>>> >>>>>> ...Marvin >>>>>> >>>>>> >>>>> I just checked the history of go spec: >>>>> https://github.com/golang/go/commits/master/doc/go_spec.html?after=mYQZV1%2BzTdUijP2zU6cxhOKduNorNTI0 >>>>> It looks there is only one main change, from >>>>> >>>>> TypeDecl = "type" ( TypeSpec | "(" [ TypeSpecList ] ")" ) . >>>>> TypeSpecList = TypeSpec { ";" TypeSpec } [ ";" ] . >>>>> TypeSpec = identifier Type . >>>>> >>>>> to >>>>> >>>>> TypeDecl = "type" ( TypeSpec | "(" { TypeSpec ";" } ")" ) . >>>>> TypeSpec = identifier Type . >>>>> >>>>> so go authors may really think "T0 and T0" is worth mentioning in go >>>>> spec. >>>>> >>>>> BTW, I think it would be less confusing if "originate in the same >>>>> TypeSpec <https://golang.org/ref/spec#Type_declarations>" changed to >>>>> "originate in the same TypeDecl". >>>>> <https://golang.org/ref/spec#Type_declarations> >>>>> >>>>> >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "golang-nuts" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to golang-nuts...@googlegroups.com. >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> -- >> You received this message because you are subscribed to the Google Groups >> "golang-nuts" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to golang-nuts...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.