Re: [go-nuts] Oxymoron: language spec: ``untyped boolean value''

2016-11-03 Thread adonovan via golang-nuts
On Wednesday, 2 November 2016 11:24:38 UTC-4, Martin Steffen wrote: > > I meant more: the _terminology_ of being untyped may reflect an internal > treatment of how the go compiler treats > those things: inside the go-compiler, the ``static phase''/type > checker/type inferencer may treat > for

Re: [go-nuts] Oxymoron: language spec: ``untyped boolean value''

2016-11-02 Thread Martin Steffen
Thanks. I may have been imprecise using ``implementation specific''. I did not mean it in the C-like manner that the ``meaning'' of some (typed) value depends on the platform (length of some words) or the choice of the compiler writer for a given platform. I meant more: the _terminology_

Re: [go-nuts] Oxymoron: language spec: ``untyped boolean value''

2016-11-02 Thread Ian Lance Taylor
On Wed, Nov 2, 2016 at 4:27 AM, Martin Steffen wrote: > > So calling the use of "ok" an ``untyped boolean'' it seems a bit > Go-specific (and/or go-implementation-centric) > terminology. Indeed the section about "constants" (mentioned in an earlier > reply) sheds some

Re: [go-nuts] Oxymoron: language spec: ``untyped boolean value''

2016-11-02 Thread Martin Steffen
Thanks for all the replies. Basically it is more like a puzzlement over choice of terminology, not so much what the meaning resp. purpose of the ``special form'' of assignments (with ``ok'') is. So calling the use of "ok" an ``untyped boolean'' it seems a bit Go-specific (and/or

Re: [go-nuts] Oxymoron: language spec: ``untyped boolean value''

2016-11-02 Thread Jan Mercl
On Wed, Nov 2, 2016 at 9:09 AM Martin Steffen wrote: > How should one interpret that? If ok behaves like a boolean, why is it considered as untyped? Because, in this special case, it really is untyped. It works the same way as untyped {int,float,...} constants, ie. an

Re: [go-nuts] Oxymoron: language spec: ``untyped boolean value''

2016-11-02 Thread Gustavo Niemeyer
It's a constant literal until it's used in a typed context. This section explains it in detail: https://golang.org/ref/spec#Constants On Wed, Nov 2, 2016 at 6:09 AM, Martin Steffen wrote: > Hi, in the language spec, e.g. in connection with ``type assertions'' and >

[go-nuts] Oxymoron: language spec: ``untyped boolean value''

2016-11-02 Thread Martin Steffen
Hi, in the language spec, e.g. in connection with ``type assertions'' and ``special forms'', like v, ok = x.(T) it's stated that it yield (in ok) an additional value which is both untyped and boolean (an ``untyped boolean value''). How should one interpret that? If ok behaves like a