Hi,

Just a couple of friendly notes / impressions: I couldn't help but notice 
how many new gramars, or additions would need to be added to the language 
in order to support a feature aiming to be simple, in a language where one 
of the top driving goals it to be as simple as possible. Also no built in 
types would be able to satisfy both of the constraints, because you can't 
declare methods on builtin types in order to satisfy the interface. 
Lastly, remember this code:

package main

import (
    "fmt"
)

type word string

func main() {
    var x word = "hello"

    var z string = x
}

Wont compile, with the message:

"cannot use w (type word) as type string in assignment"

But:



package main

import (
    "fmt"
)

type word string

func main() {
    var w word
    w = "What am I?"
    var z string
    
    fmt.Printf("w is a: %T. z is a %T.\n", w, z)

Does, and prints out:

w is a: main.word. z is a string.

( Runnable example: https://play.golang.org/p/wek23WOXNEJ )

Because they are two different things, It would be akin to attempting to 
assign an int value to a var of type uint16.




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