Re:Go channels, goroutines and GC available in Nim
by duaneb on Monday June 01, 2015 @04:07PM
(#9641758)
> Since Nim is a superset of Go
I seriously doubt that Nim is out of the box binary compatible with another runtime's fundamental types.
Re:Go channels, goroutines and GC available in Nim
by kodablah on Monday June 01, 2015 @04:10PM
(#9641780)
I am not looking for binary compatibility. I am looking for feature parity. Go interfaces can be handled with concepts [1] or just macros. I am talking about an alternative Go implementation (i.e. just sitting on top of Nim), not ABI compat between the two runtimes.
Re:Go channels, goroutines and GC available in Nim
by duaneb on Tuesday June 02, 2015 @02:03PM
(#9647734)
Along that way is C++ and "we should attempt to be a superset of all programming paradigms". Fewer features is better, and more restrictions allow better tooling and iteration if they don't functionally restrict the programmer.
Basically, I'm not sure of the benefit of building go on top of nim. They appear to fill the same space in orthogonal ways.
Re:Go channels, goroutines and GC available in Nim
by aikah on Monday June 01, 2015 @03:37PM
(#9641525)
> Since Nim is a superset of Go
what ?
Re:Go channels, goroutines and GC available in Nim
by kodablah on Monday June 01, 2015 @03:51PM
(#9641634)
I was under the impression this was true feature-set wise. I may be wrong though and am happy to be corrected.
Re:Go channels, goroutines and GC available in Nim
by worklogin on Monday June 01, 2015 @04:13PM
(#9641800)
Calling something a superset usually means it's actually an expansion of something... kind of like C++11 might be a superset of C++03 (not sure if that's accurate).
Re:Go channels, goroutines and GC available in Nim
by MichaelGG on Monday June 01, 2015 @04:55PM
(#9642089)
That's a really strange metric to use. It'll rarely be true, except in a sort of Turing completeness way.
Re:Go channels, goroutines and GC available in Nim
by stefantalpalaru on Monday June 01, 2015 @04:12PM
(#9641786)
Almost. Go had the advantage of M:N threading with its goroutines and elegant CSP implementation.
Re:Go channels, goroutines and GC available in Nim
by stefantalpalaru on Monday June 01, 2015 @02:57PM
(#9641238)
> why not a Go implementation in Nim via cross-compilation?
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.
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.
It should be easy to bootstrap by first using Go's parser to dump some AST that Nim code can then translate, and then once that version is done, just reference the Go parser using this new impl. The only real struggle with the project from what I can see is deciding which standard library items to use the Go transpiled implementation (probably most of them) vs which need to have Nim backends (e.g. runtime package). Meh, just rambling thoughts in my head I was considering playing with given the time...