News for hackers. Stuff that matters.
Re:Go generics may use square brackets [] not parenthesis () by rsc on Tuesday July 14, 2020 @10:22PM (#23840503)
It is solved by doing unbounded parser look-ahead (if you need that) or by requiring that all tools have full type information to understand programs (if you need that).

It is definitely better for tooling not to need either, both for human readers and mechanical tools

The example in the mail shows that using angle brackets with Go would require full type information, making simple tools like gofmt impossible.

Re:Go generics may use square brackets [] not parenthesis () by ckok on Wednesday July 15, 2020 @04:49AM (#23842742)
Note that C#, Pascal don't "know" about known types during parsing like parsing C/C++ requires, it knows how a type is formatted, what it's looking for is: '<' ValidType (',' ValidType)+ '>'

If that's there, it's a generic, else it's an identifier, and somewhere up the parsing chain will take that up as LessThan.

Re:Go generics may use square brackets [] not parenthesis () by deanCommie on Tuesday July 14, 2020 @10:34PM (#23840572)
> making simple tools like gofmt impossible.

So now we're making language design decisions based on the limitations of the bonus linter?

My opinion of Golang drops more and more with every new detail I learn about it...

Re:Go generics may use square brackets [] not parenthesis () by doctor_eval on Tuesday July 14, 2020 @11:05PM (#23840761)
One of the benefits of Go is super fast compilation time. Unlimited look ahead is likely to make the compiler slower. Ergo, it’s not a great idea.
Re:Go generics may use square brackets [] not parenthesis () by estebank on Wednesday July 15, 2020 @01:05PM (#23848121)
Parser speed is negligible contributor to slowness in any compiler. rustc has a couple of places were it performs bounded lookahead to supply suggestions for incorrect code, but the grammar of the language is regular. 3rd party tools don't have to worry about it, and users get accurate suggestions. The cost is 1) you have to implement a more complex parser while 2) making people go "you already know what I meant, just take it without me using the 'ugly' turbofish". It think this is the correct approach for language design.
Re:Go generics may use square brackets [] not parenthesis () by monocasa on Tuesday July 14, 2020 @10:39PM (#23840601)
Go has a lot of problems, but continung to support gofmt's quest including the simplicity it desires isn't one of them.