Re:Go channels, goroutines and GC available in Nim
by kodablah on Monday June 01, 2015 @03:26PM
(#9641439)
I don't believe they should accept the full Golang syntax, just help with the import. E.g.
macro goImport(path: string): stmt
// TODO
discard
goImport("golang.org/x/crypto/nacl/box")
Re:Go channels, goroutines and GC available in Nim
by stcredzero on Monday June 01, 2015 @03:02PM
(#9641275)
If you front compilation with Go's parser, you could generate bog-standard Nim code from the AST.
Re:Go channels, goroutines and GC available in Nim
by stefantalpalaru on Monday June 01, 2015 @04:07PM
(#9641757)
You can, but you'd be limiting yourself to pure Go. I'd rather have Go with Nim's generics, transpilation to C, macros, compile time computation, etc.
Nim's macros have one limitation that prevents an accurate implementation of another syntax: they can't fully modify the existing syntax.
See how I had to use "scase" inside "select" blocks because the existing "case" keyword insists on having "of" after it. So Nim's semantics put some limits on the amount of hijacking one can inflict on it through macros.