2 ms·
Ah, from slide #39 A problem Can't run a goroutine to completion during initialization. Forbidden by the language specification. (Raises awful issues a
by wahern 4y ago
Ah, from slide #39
A problem
Can't run a goroutine to completion during initialization.
Forbidden by the language specification.
(Raises awful issues about order of init, best avoided.)
That means we can't lex & parse a template during init.
The goroutine is a problem....
https://talks.golang.org/2011/lex.slide#39 https://talks.golang.org/2011/lex.slide#39
Removing the use of goroutines seems to have been simple. Not too surprised as lexers don't usually need very deep call stacks, anyhow. (A single loop and switch can suffice in most situations. Or a single level of calls when one is inclined to break things out into a function dispatch table.) In Lua I've found coroutines more useful for writing iterators over trees, where there's mutual recursion.