Go versus Brand X

Antoine Pitrou solipsis at pitrou.net
Mon Nov 23 21:47:37 CET 2009

Le Mon, 23 Nov 2009 11:54:19 -0600, Robert Kern a écrit :
> Not really. The idea was to make the language easily parsed and lexed
> and analyzed by *other* tools, not written in Go, that may have limited
> capabilities.

Well, if Go doesn't allow you to write libraries usable from other low-
level languages I'm not sure it is a good systems programming language.
One point of C is that you can bridge it with everything.

> Vim isn't written in Go and won't be able to use their
> API, for example.

Syntax highlighting doesn't require a full-blown parser. You probably 
want to handle three types of events:
- comments (and docstrings and the like for languages which have them)
- keywords
- delimiters of basic syntactical blocks (which most of the time is 
simply matching pairs of parens / square brackets / curly brackets)

That is, you need a very small part of the information a complete parser 
would give you.
In particular, you don't need to know about operator precedence. You 
don't need to know about what kind of block you are inside (function, 
method, class...). You don't need to know whether an identifier is a 
local variable, a global variable, a type, etc. You don't even need to 
know the different operators. You only need to recognize the basic 
lexemes and that's all.

The reason the Go designers gave for the braindead syntax looks 
dramatically unserious and makes it look a bit like a joke.
(actually, what really made me wonder whether Go was a joke was the 
"iota" keyword)

More information about the Python-list mailing list