Sighs. I wish Nimrod were more popular. It seems like a better version of D. But there can only be so many languages with a fully functioning ecosystem, and I just doubt Nimrod will ever get there. It seems to be a one-man shop at this point (as this demonstrates):
I am always amazed how quickly I get things done with Nimrod. It's like writing Python, having the full power of C (see below), and some of the power of Lisp (macros!), and getting the performance of C++. Nimrod actually is what I wanted Python to be.
For instance, I just need to add two lines to import C's printf and fprintf:
This. I'm on the lookout for expressive, statically typed, native code compiling languages for game development. Currently poking around with Rust, since Go seems to pretty much be settled on not doing the custom expressibility thing. Nimrod looks like something I'd really want to like, the game stuff I do doesn't really need Rust's hardcore garbage collection avoidance, but the ecosystem sparsity just scares me off. Meanwhile, Rust has both reasonably heavy institutional support and an impressive swarm of adventurous game developers with a C++ background working on stuff for it. I'm banking on Rust mostly for the potential ecosystem strength in being the only alternative to C++ for a high level of abstraction don't pay for what you don't use language.
It is getting there, as can be seen by the Contributions graph in that link. Aside from the fact it's mostly from Araq, the graph looks very healthy and encouraging. I actually just started using it for my next biggest project, after a week or so of looking into haskell, Ocaml, and Lua.
I use NodeJS quite a bit, which has massive ecosystem, but recently (and especially After TJ Hollowaychuk's announcement about moving to Go) I've been taking a fresh look at these new-fangled systems languages, including Go, Rust and Nimrod, plus Apple Swift. If I'm going to tool and skill up in a new systems language, I want not just performance and nice syntax but also reach. Of the three, Nimrod is the only one with a convincing story for running on the main consumer platforms (iOS, Android, Windows), server platforms (Linux, *NIX) and embedded systems - because it compiles to C or Objective C (or JS for that matter!). That strikes me as a neat approach. Whilst there are attempts to get Rust and Go compiling for iOS, they don't seem very advanced.
The small ecosystem is definitely a concern, but could also be an opportunity for a mid-sized IT corp to step into the ring with the big hitters and all their shiny new systems languages by backing this project.
I do think Nimrod will catch on in a little while. It has amazing potential. But things like type classes aren't done yet.
Personally I believe Nimrod will be perfect as a Hardware Description Language. There's a couple of features missing, but they're currently being worked on. This is an area where Nimrod could really shine, and where it could start to gain massive commercial support.
Anyone know the recommended way to do interop with C and Nimrod? I've been doing Project Euler problems in Nimrod, and wanted to use some library functions from GSL for bignum support, but I couldn't really get c2nim to work with the header files.
I think that I could use the 'importc'/'dynlib' with the compiled library, but there's not a whole lot of documentation on that in the Nimrod manual, and I ended up just doing that problem in C because it was easier (read: I was lazier) to get working.
To the curious - I got this working (thank you def- for the rosetta code examples!). Point of correction - the library I was actually using for bignum support was GMP, not GSL. (I was getting confused because I used functions from GSL for a different problem).
Importing a standard procedure from a C library like GMP actually is pretty easy (use the importc/header pragmas).
Here's what tripped me up:
* Calling variadic functions from Nimrod (just wrote a wrapper)
* Getting to link against gmp (used the passL: "-lgmp" pragma)
* Remembering to free what was allocated by C library functions (can't GC what you didn't allocate) - caught with valgrind
I'll probably push to my github repo, but can post to a pastebin or something if there's interest in a less cookie-cutter example
I'm afraid the memory management scheme might cause the Nimrod ecosystem to end up with too many libraries that require GC, and since the building blocks are already using it, why not use it yourself?
Either make it fully manual, or do something like Rust (No small feat). A GC you can switch on and off sounds like a good idea, but programmers don't keep half the promises they make ("It's just an MVP, I'll refactor it to use manual memory later").
> I'm afraid the memory management scheme might cause the Nimrod ecosystem to end up with too many libraries that require GC, and since the building blocks are already using it, why not use it yourself?
And what would be the problem with that? The number of application domains where even soft real-time GC is inappropriate is very, very small. And designing freedom from garbage collection into a language (other than the simple option of allowing manual allocation/deallocation) is not cost-free, either, and can weigh down the design, too. You can optimize your language design for having garbage collection or for not having garbage collection, but if you try to do both at once, a language design that specifically favors one or the other will likely beat out the compromise solution for the case it's optimized for.
And yes, that means that Nimrod (or any other language) won't be perfect for everything under the sun. Which is fine: there's nothing wrong with having multiple programming languages, each of which is better suited for a different task.
No, I think Nimrod's approach is absolutely correct.
What I hope will happen is that once Nimrod's effects system matures, the compiler will be able to figure out when it can statically free references when they go out of scope, rather than always using the GC.
Rusts approach, I think, is in the entirely wrong direction. You should only have one kind of reference, but if you use it correctly the compiler should figure out how to free it. You should then be able to make an assertion that a procedure (possibly "main") does not allocate any GC memory, and have the compiler tell you what part of your code violates this constraint.
Still, there are times when GC is fine for a particular application. In those cases, Nimrod is pretty fantastic, especially given its metaprogramming capabilities.
[+] [-] tdees40|11 years ago|reply
https://github.com/Araq/Nimrod/graphs/contributors
[+] [-] progman|11 years ago|reply
For instance, I just need to add two lines to import C's printf and fprintf:
proc printf(frmt: CString) {.importc: "printf", nodecl, varargs, tags: [FWriteIO].}
proc fprintf(f: TFile, frmt: CString) {.importc: "fprintf", nodecl, varargs, tags: [FWriteIO].}
Now I can use these C functions seamlessly (even without parentheses):
printf "Hello %s!\n", "world"
fprintf stderr, "Error in line %d\n", $nr
[+] [-] rsaarelm|11 years ago|reply
[+] [-] fuzzythinker|11 years ago|reply
[+] [-] fineline|11 years ago|reply
The small ecosystem is definitely a concern, but could also be an opportunity for a mid-sized IT corp to step into the ring with the big hitters and all their shiny new systems languages by backing this project.
[+] [-] audunw|11 years ago|reply
Personally I believe Nimrod will be perfect as a Hardware Description Language. There's a couple of features missing, but they're currently being worked on. This is an area where Nimrod could really shine, and where it could start to gain massive commercial support.
[+] [-] spyder|11 years ago|reply
[+] [-] perturbation|11 years ago|reply
I think that I could use the 'importc'/'dynlib' with the compiled library, but there's not a whole lot of documentation on that in the Nimrod manual, and I ended up just doing that problem in C because it was easier (read: I was lazier) to get working.
[+] [-] def-|11 years ago|reply
http://rosettacode.org/wiki/Call_a_foreign-language_function...
http://rosettacode.org/wiki/Call_a_function_in_a_shared_libr...
http://rosettacode.org/wiki/Use_another_language_to_call_a_f...
Making c2nim work with header files can be a bit difficult. The main information is here: http://nimrod-lang.org/c2nim.html
When something throws an error I comment it out and try to see if I can fix it up by hand.
[+] [-] perturbation|11 years ago|reply
Importing a standard procedure from a C library like GMP actually is pretty easy (use the importc/header pragmas).
Here's what tripped me up:
* Calling variadic functions from Nimrod (just wrote a wrapper)
* Getting to link against gmp (used the passL: "-lgmp" pragma)
* Remembering to free what was allocated by C library functions (can't GC what you didn't allocate) - caught with valgrind
I'll probably push to my github repo, but can post to a pastebin or something if there's interest in a less cookie-cutter example
[+] [-] ilaksh|11 years ago|reply
[+] [-] eudox|11 years ago|reply
Either make it fully manual, or do something like Rust (No small feat). A GC you can switch on and off sounds like a good idea, but programmers don't keep half the promises they make ("It's just an MVP, I'll refactor it to use manual memory later").
[+] [-] rbehrends|11 years ago|reply
And what would be the problem with that? The number of application domains where even soft real-time GC is inappropriate is very, very small. And designing freedom from garbage collection into a language (other than the simple option of allowing manual allocation/deallocation) is not cost-free, either, and can weigh down the design, too. You can optimize your language design for having garbage collection or for not having garbage collection, but if you try to do both at once, a language design that specifically favors one or the other will likely beat out the compromise solution for the case it's optimized for.
And yes, that means that Nimrod (or any other language) won't be perfect for everything under the sun. Which is fine: there's nothing wrong with having multiple programming languages, each of which is better suited for a different task.
[+] [-] audunw|11 years ago|reply
What I hope will happen is that once Nimrod's effects system matures, the compiler will be able to figure out when it can statically free references when they go out of scope, rather than always using the GC.
Rusts approach, I think, is in the entirely wrong direction. You should only have one kind of reference, but if you use it correctly the compiler should figure out how to free it. You should then be able to make an assertion that a procedure (possibly "main") does not allocate any GC memory, and have the compiler tell you what part of your code violates this constraint.
[+] [-] charlieflowers|11 years ago|reply
[+] [-] aikah|11 years ago|reply
[+] [-] dom96|11 years ago|reply
You may also be interested in the C#-like async await as shown in the following news article: http://nimrod-lang.org/news.html#Z2014-04-21-version-0-9-4-r...
[+] [-] WaxProlix|11 years ago|reply
[+] [-] reirob|11 years ago|reply
[+] [-] ludwigvan|11 years ago|reply
[+] [-] gomesnayagam|11 years ago|reply