On Thu, Jul 16, 2020 at 3:12 PM 'Axel Wagner' via golang-nuts <golang-nuts@googlegroups.com> wrote:
> I dislike the idea of using $ and @ because I don't want to add new symbols > to the language, if it can be avoided. In general I'd argue that Go tends to > use keywords instead of symbols to convey meaning - e.g. we don't write `a -> > b`, but `func(a) b`. There are exceptions (pointers are a big one) of course, > but Go is still pretty light on symbols. > I think the overuse of symbols to convey semantics is a huge reason that I > find perl and Haskell so unreadable, personally. There are 31 printable, non blank, non-digit, non-letter ASCII symbols. Go (lexical grammar) currently uses 27 of them. I'm not sure if using 27 of 31 vs using 29 out 31 makes a notable difference. (I have not counted smybol groups like ":=" ">=", "<-" etc., but that makes the number of symbols used in Go only bigger, not smaller.) But of course, a keyword would work as well. For example, $ can be replaced with no semantic change with 'type'. And @ can be dropped while keeping the original draft syntax for type instantiation - and the original parsing ambiguities. Then we can have something like Original: func Keys(type K comparable, V interface{})(m map[K]V) []K { ... } s := Keys(int, string)(m) Alternative-AW: func Keys(m map[type K comparable]type V) []K s := Keys(int, string)(m) FTR: In the alternative draft I missed the `~` (tilde) character, so there are not 3 but actually 4 ASCII symbols not used by Go. But I like the $, @ option because the language change is pushed "down" to be based mainly in the lexer grammar. I haven't made any attempt to write a parser for the alternative draft, but I think this makes the changes on top of the existing parser pretty minimal. The original draft, on the other hand, needs IMO much more changes. -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAA40n-VwE2URengdE0Cd7sPQNCm5%3DTm5%3DaUS8kMwOpEw%3DXjJyg%40mail.gmail.com.