Hacker News new | past | comments | ask | show | jobs | submit login

Is that really less clear?



I think so -- if I see this it's obvious now is a function.

    func now() time.Time { return time.Now() } 
If I see this:

    var now = time.Time
My first instinct is, "hmmm, some kind of variable?" And then I have to remember, "oh yeah, it's just a variable that holds a function."

Obviously not a big deal either way.

(I think this further shows how type aliases would not be adding much possibility for confusion compared to what already exists in the language.)


btw if you want you can explicit mention the type in the var declaration




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: