On Wed, Nov 2, 2016 at 12:27 PM Martin Steffen <martin.sput...@gmail.com>
wrote:

> "An untyped constant has a default type" (*)
>
> sounds ``oxymoronic'' to the unsuspecting: something is called "untyped"
> _but_ at the same time ``has a type''.

It has no type. It acquires one when 1) being assigned to something that
has (must have) a type - then its type becomes the type of the destination
and it's converted as such if possible 2) when used in a short var
declaration, then the type is selected as specified, eg. untyped bool
becomes bool. But the untyped bool has no type. It has a "kind", distinct
from untyped integer values, for example. Being untyped is an important
concept allowing to conveniently break out of the assignability rules where
considered appropriate by the language designers. (I like it.)

Side note: In the `thing, ok := expr ` special cases there are no
constants/literals are involved.

-- 

-j

-- 
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