Re:Nimrod: A new approach to metaprogramming
by TylerE on Friday November 29, 2013 @03:12PM
(#6820829)
For embedded use it's probably ok, anywhere C is ok. It statically links the bits of the stdlib you use but dead code elimination seems to work pretty well.
A simple word counting script I just wrote compiles down to about 52k on 64bit OS X.
Re:Nimrod: A new approach to metaprogramming
by flyinglizard on Friday November 29, 2013 @07:46PM
(#6821705)
I also wonder about Nimrod on embedded. The dealbreaker is dynamic memory allocation; if Nimrod does that as a non-negotiable part of its runtime, it can't be used.
Re:Nimrod: A new approach to metaprogramming
by jamesaguilar on Saturday November 30, 2013 @08:17AM
(#6823060)
It looks like this might rely on the GC. From the description, you can cut that out too if you handle cleanup yourself. Not sure though.
Re:Nimrod: A new approach to metaprogramming
by progman on Friday November 29, 2013 @03:29PM
(#6820896)
Thanks - but your example is Python code ??
Re:Nimrod: A new approach to metaprogramming
by TylerE on Friday November 29, 2013 @03:33PM
(#6820916)
No, it's Nimrod. I set it to python in gist because that's the closest to nimrod for syntax highlighting purposes.
Edit: Apparenetly not...there are alot more modes in there but the UI exposing them is easy to miss
Re:Nimrod: A new approach to metaprogramming
by hcarvalhoalves on Friday November 29, 2013 @03:30PM
(#6820898)
> Nimrod actually is where Python should be.
I guess you meant "what I wanted Python to be".
I don't see how Nimrod is a natural evolution of Python. Static types and meta-programming by templates are far from anything Python proposes. I believe not even the syntax comparison applies too much, it's syntax is more reminiscent of Pascal than Python itself.
Re:Nimrod: A new approach to metaprogramming
by TylerE on Friday November 29, 2013 @03:43PM
(#6820954)
As someone who has spent much of the last decade or so writing Python, I mostly disagree. The pain points I've had with python (speed, mainly) are well catered to by Nimrod. I agree that it's not "pythonic" in some ways, but the feeling is very similar. The wtfs/line ratio is very low.
Re:Nimrod: A new approach to metaprogramming
by twotwotwo on Friday November 29, 2013 @04:28PM
(#6821090)
> I am working with Nimrod right now
Cool! Is what you're working on public?
Re:Nimrod: A new approach to metaprogramming
by progman on Saturday November 30, 2013 @05:11AM
(#6822778)
Not yet. I am working on a replacement for the Asciidoc/Docbook toolchain which I am not satisfied with. It handles an extended version of Asciidoc and aims to produce code for a few output formats (HTML, TeX).
Re:Nimrod: A new approach to metaprogramming
by mmfZ4e4OqQ7RRwP on Saturday November 30, 2013 @10:33AM
(#6823372)
Nimrod includes rst parsing and html/tex generation (http://build.nimrod-lang.org/docs/rstgen.html). While orthogonal to your quest you may want to look into its implementation for inspiration (or adopt rst instead of asciidoc for your publishing needs).
Re:Nimrod: A new approach to metaprogramming
by progman on Saturday November 30, 2013 @02:51PM
(#6824346)
Interesting. I'll take a closer look at it.
Re:Nimrod: A new approach to metaprogramming
by andrewflnr on Friday November 29, 2013 @03:14PM
(#6820843)
What do you mean by "Nimrod is where Python should be"? The two languages are aimed at very different use cases.
Re:Nimrod: A new approach to metaprogramming
by progman on Friday November 29, 2013 @03:27PM
(#6820889)
Nimrod provides the features which I wanted to have when I developed with Python: type system, Perl regex, range subtypes, easy C interface. native compiler(s). I know PyPy but Nimrod needs much less space to compile.
- clean Pythonic syntax (whitespace relevant but tabs are forbidden)
- native Perl syntax for regular expressions (slide 42)
- subrange types as in Ada
- set types as in Pascal
- strings as case (switch) selectors
- easy C interface with automatic type conversion (only functions as parameters need additional compiler pragmas)
- typed macros (templates)
- object code: native, C, Javascript (probably more to come)
I am working with Nimrod right now, and it is really one of the most productive languages that I ever encountered. It seems to mix the best features of other popular languages. Nimrod actually is where Python should be. I wonder if it is suitable for small embedded systems also.
By the way, one important difference to Perl regular expressions is that re"..." always parses the whole expression where Perl parses partially. Fortunately Perl's behavior can easily be simulated with a template.