Hacker News new | ask | show | jobs
by arghblarg 2189 days ago
For what it's worth from the Peanut Galleryâ„¢, I find the proposed syntax quite readable and am happy there are no angle brackets <> stabbing my eyes.

It seems powerful enough to cover most cases of generics. Architecture astronauts will never be happy, but tough.

2 comments

I'd definitely prefer angle brackets. With everything being parantheses I just get lost keeping track of what is what - they're now used for type parameters, parameters and return values, one after the other with no separation, and two of them are optional. Quite confusing if you ask me.
And yet, if you think about parsing it, they're all ways to group things together. Avoiding adding reserved characters (see also the discussion about adding ternaries) is a worthy goal to pursue. Keeps the parser(s) simpler too.

An IDE / coloring scheme can help make things look more distinct if need be.

Comparing it with the builtin hashtable:

* the custom one: hashtable.Table(string, int)

* the builtin one: map[string]int

The syntax forms are quite different. Wouldn't it be better to make them consistent? Is it so hard to achieve this?

It would not surprise me to learn that the parser has special rules for the token "map".
Yes, the fact that "map" is a keyword and "Table" is not really makes a trouble for parser. But I think we should think towards the road. There should be always a solution.
lisp