Live data from Hacker News

Nimrod for C programmers

github.com

11–20 of 67 posts

Re: Nimrod for C programmers

#11
post #2

Every time i look at this language feature, it seems like a dream come true. Yet, i stopped believing in santa when i was 4 so could anyone here points at its ugly parts ?

This is the first time I've heard of Nimrod and being an amateur C user these are the parts I don't like:

- No curly braces around anything.

- Whitespace seems to be important, just like python.

- Some nonsense about unsigned integers.

The best thing I saw was that it has C's explicit-size integers. The one thing I wish every C program would use rather than having configure guess which basic type it should use.

Re: Nimrod for C programmers

#12
post #3
post #2

Every time i look at this language feature, it seems like a dream come true. Yet, i stopped believing in santa when i was 4 so could anyone here points at its ugly parts ?

As someone who's played with it extensively (to the point of trying to build a new type system for it, though its slower going than I'd hoped as I lack the necessary skills currently, though I'm still working on it) -- it's library situation isn't as robust as I'd like. It's community is small but very fervent and super helpful (Araq and Dom are both amazing guys and will help you out in IRC whenever you need it). I'…

Have you tried using it in production (for some value of "production")? I wrote a web API "Hello, world!" in Jester about half a year ago as a way to learn a little Nimrod and at first glance found it to be a nice web framework.

Looking at Nimrod's AST macros (which I haven't used) I imagine Julia as a closer competitor to it than Go. They both appear to come from a "programmable programming language" mindset, though Julia arguably more so because it's homoiconic.

Re: Nimrod for C programmers

#13
post #2

Every time i look at this language feature, it seems like a dream come true. Yet, i stopped believing in santa when i was 4 so could anyone here points at its ugly parts ?

This is the first time I've heard of Nimrod and being an amateur C user these are the parts I don't like: - No curly braces around anything. - Whitespace seems to be important, just like python. - Some nonsense about unsigned integers. The best thing I saw was that it has C's explicit-size integers. The one thing I wish every C program would use rather than having configure guess which basic type it should use.

  - No curly braces around anything.
  
  - Whitespace seems to be important, just like python.
That might be a 'bug' for you, but that's a feature for most. At least for Python, Yaml, Coffeescript, Jade, Stylus and Nimrod users :)

Re: Nimrod for C programmers

#14

How does Nimrod compare to Rust, in terms of goals?

Many people see them sitting in a similar space, but all things considered Rust's goal is safety, well Nimrod is more interested in metaprogramming and other features that take precedence over safety.

All in all, I have looked into Nimrod a few times. It is very, very cool. One guy is even using the Obj-C bridge to run a core of an iOS app on it. You could theoretically now write a web API, an Android app core (not the GUI), and an iOS app core (not the GUI), and have them running all off the same logic written in Nimrod.

I highly recommend checking out the forum and see the caliber of stuff these guys are putting out. Very impressive stuff.

http://forum.nimrod-lang.org/

Re: Nimrod for C programmers

#15
post #3

Earlier quoted context omitted.

As someone who's played with it extensively (to the point of trying to build a new type system for it, though its slower going than I'd hoped as I lack the necessary skills currently, though I'm still working on it) -- it's library situation isn't as robust as I'd like. It's community is small but very fervent and super helpful (Araq and Dom are both amazing guys and will help you out in IRC whenever you need it). I'…

Have you tried using it in production (for some value of "production")? I wrote a web API "Hello, world!" in Jester about half a year ago as a way to learn a little Nimrod and at first glance found it to be a nice web framework. Looking at Nimrod's AST macros (which I haven't used) I imagine Julia as a closer competitor to it than Go. They both appear to come from a "programmable programming language" mindset, though…

The Nimrod forum (http://forum.nimrod-lang.org) uses Jester in production and so far its working very well.

Re: Nimrod for C programmers

#16

How does Nimrod compare to Rust, in terms of goals?

Rust focuses very much on low/no-overhead memory safety (especially memory safety without a GC), while Nimrod seems to be more focused at more convenient low-level programming, but without quite such a strong push for memory safety and reliable very high performance (e.g. GC is compulsory for safety).

That's not to say that Rust isn't convenient, but the quest for strong memory safety & performance guarantees doesn't come for free: satisfying the borrow checker can get a little tricky at times.

An example of this: Rust's type system is designed to allow things like building a safe shared memory abstraction[1], that is, a shared memory type that enforces non-thread-safe data can't be shared without being inside a mutex. My reading of the Nimrod FAQ[2] ("An unsafe shared memory heap is also provided") implies this isn't (as easily) possible in Nimrod.

(Disclaimer: I know a lot of Rust, but very little Nimrod.)

[1]: http://static.rust-lang.org/doc/master/sync/struct.Arc.html

[2]: http://nimrod-lang.org/question.html

Re: Nimrod for C programmers

#17

I strongly disagree with the rationale for not supporting unsigned integer types by default. In fact, I think unsigned should be the default, and the advice on the Escher Technologies blog is harmful. Other than that, Nimrod has been a pleasure to use. If you need a metaprogramming language to generate C, use Nimrod.

I'll assert that a majority of C programmers do not understand unsigned types and misuse them.

It's quite common to end up needing to use both signed and unsigned types in the same expression and to end up invoking undefined behaviour trying to protect yourself. C overflow semantics (i.e. undefined) in particular.

Signed types should be the default, and overflow should be defined as wrapping two's complement. There's very good reasons why C# and Java chose these defaults.

The places where unsigned numbers are justified are incredibly rare: bitwise operations, and working with >2GB heap sizes on 32-bit machines. That's about it. In almost every other circumstance, using a signed type (the next size up if the range is inadequate) is better.

Especially pernicious is using something like size_t for things like container entry counts. It's very common to add and subtract with container counts, and very easy to end up inadvertently wrapping or mixing with signed types in common container algorithms.

PS: my experience was deeply coloured while working on the Delphi RTL, making it overflow safe. It was not trivial.

PPS: it was revealing that the comments on the article arguing in favour of unsigned types repeatedly made programming errors and invoked undefined behaviour. That's because unsigned types are misunderstood and misused.

Re: Nimrod for C programmers

#18
post #13

Earlier quoted context omitted.

This is the first time I've heard of Nimrod and being an amateur C user these are the parts I don't like: - No curly braces around anything. - Whitespace seems to be important, just like python. - Some nonsense about unsigned integers. The best thing I saw was that it has C's explicit-size integers. The one thing I wish every C program would use rather than having configure guess which basic type it should use.

- No curly braces around anything. - Whitespace seems to be important, just like python. That might be a 'bug' for you, but that's a feature for most. At least for Python, Yaml, Coffeescript, Jade, Stylus and Nimrod users :)

A "C" type programming language with no curly brackets (or equivalent) and significant whitespace is a huge negative for me and utter deal breaker. This is the first time I have heard about Nimrod and was very interested to see more. It was all looking so good until I came to this part. Literally I stopped browsing the Nimrod site and closed it down (with some regret) as soon as I saw this.

Not interested anymore.

Re: Nimrod for C programmers

#19

I strongly disagree with the rationale for not supporting unsigned integer types by default. In fact, I think unsigned should be the default, and the advice on the Escher Technologies blog is harmful. Other than that, Nimrod has been a pleasure to use. If you need a metaprogramming language to generate C, use Nimrod.

Fully agree. Lot of pogrammers misunderstands signed types which results in different bugs when combining signed with unsigned.

More importantly though, not having unsigned types, as in Java, means that we have to use 16-bit int to store a byte, 32-bit int to store a 16-bit unsiged etc.

Btw, if you check any C code, you'll notice that is vast majority of cases negative values of int are actually invalid from the business logic point of view.

Re: Nimrod for C programmers

#20
post #2

Every time i look at this language feature, it seems like a dream come true. Yet, i stopped believing in santa when i was 4 so could anyone here points at its ugly parts ?

This is the first time I've heard of Nimrod and being an amateur C user these are the parts I don't like: - No curly braces around anything. - Whitespace seems to be important, just like python. - Some nonsense about unsigned integers. The best thing I saw was that it has C's explicit-size integers. The one thing I wish every C program would use rather than having configure guess which basic type it should use.

> - No curly braces around anything.

Do you find curly braces to have some aesthetic? That you like to see it in code for its own sake?

Post reply on HN