3 ms·
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
by dilap 10y ago
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.)
- ithkuil 10y agobtw if you want you can explicit mention the type in the var declaration