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 go-implementation-centric)
terminology. Indeed the section about "constants" (mentioned in an earlier 
reply) sheds some light,  in 
that it's a special case of how the Go specification speaks about typing 
issues surrounding literals.

But still, the sentence in that section of the language specification there 
spelling it out as

"An untyped constant has a default type" (*)


sounds ``oxymoronic'' to the unsuspecting: something  is called "untyped"
_but_  at the same time ``has a type''. Of course it's the official
specification, so it is how it formulated as it is and one can live with 
it.  but still a
bit strange manner of speaking. 



PS: oxymoron means not being a self-contradictory statement as such, but a 
formulation that "appears to be contradictory''  
which upon first reading applies to the formulation (*) at least for me :-)




On Wednesday, November 2, 2016 at 12:04:39 PM UTC+1, Pietro Gagliardi 
(andlabs) wrote:
>
> It means there is no specific type name, but the resultant type must 
> either be bool or convertible to bool:
>
> type A bool
> var n int
> var ok A
> n, ok = x.(int)
>
> Using bool here is not common, but you see this with int and float, etc. 
> Untyped constants is one of the most prominent Go features.
>
> On Nov 2, 2016, at 4:09 AM, Martin Steffen <martin....@gmail.com 
> <javascript:>> wrote:
>
> 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 boolean, why is it 
> considered as untyped?
>
> Martin
>
>
>
> -- 
> 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.

Reply via email to