Live data from Hacker News

Show HN: “Nim in Action” is now available

nim-lang.org

121–130 of 139 posts

Re: Show HN: “Nim in Action” is now available

#121
My questions! I have never written a line of Nim but am enticed:

>Nim allows you to use snake_case even if the identifier has been defined using camelCase, and vice versa.

Can you also just write it all lowercase, and same synonym effect? i.e. snakecase

> The default garbage collector is real-time so it allows you to specify the amount of time it should spend on collecting memory.

Since Nim compiles to C, which is not garbage collected, does Nim just automatically add its own C-based GC library behind the scenes (no small task), or is it actually just adding calls to free for you?

> This applies to languages such as C++, Pascal and Ada. But these languages still require platform specific code when dealing with more specialised features of the operating system, such as creating new threads ...

Not true any more for C++, since the new C++ standard 5 years ago, which contains cross-platform standard library tools for multithreading.

>The speed of a programming language is one characteristic that is often used to compare multiple programming languages

Since this statement is in the book, it would be nice to see Nim programs participating in the online benchmarks game.

>Table 1.2 Common programming language features

A little misleading or perhaps just incorrect to place a No in C++'s box for metaprogramming. Entire books have been written on C++ metaprogramming.

Re: Show HN: “Nim in Action” is now available

#122
post #120

Earlier quoted context omitted.

> I just wish we could look at Nim as a language with different design goals than Rust. Claims that Nim is memory-safe when it's not is not a difference of design goal though.

See my comment https://news.ycombinator.com/item?id=10992077 It seems to me that a) Nim is (or at least is meant to be, but bugs can sidestep it) memory safe if you stay within the rules for it, and b) Nim is not throwing around vague claims of safety that are not documented in the language manual.

> It seems to me that a) Nim is (or at least is meant to be, but bugs can sidestep it) memory safe if you stay within the rules for it

That's completely worthless. C is also memory-safe if you stay within the rules for memory safety.

> Nim is not throwing around vague claims of safety that are not documented in the language manual.

Of course not since nim is not posting on HN (as it's not a sentient being prone to procrastination) it's obviously nim supporters making claims about nim's safety.

Re: Show HN: “Nim in Action” is now available

#123

My questions! I have never written a line of Nim but am enticed: >Nim allows you to use snake_case even if the identifier has been defined using camelCase, and vice versa. Can you also just write it all lowercase, and same synonym effect? i.e. snakecase > The default garbage collector is real-time so it allows you to specify the amount of time it should spend on collecting memory. Since Nim compiles to C, which is no…

Hello, thank you for the questions and feedback!

> Can you also just write it all lowercase, and same synonym effect? i.e. snakecase

Yes, the first character is case sensitive, but the rest is not. foobar == fooBar == foo_bar == foo_Bar but FooBar != fooBar.

> Since Nim compiles to C, which is not garbage collected, does Nim just automatically add its own C-based GC library behind the scenes (no small task), or is it actually just adding calls to free for you?

Nim adds its own Nim-based GC library behind the scenes. In fact, it supports multiple GCs (which can be changed via the --gc flag).

> Not true any more for C++, since the new C++ standard 5 years ago, which contains cross-platform standard library tools for multithreading.

Is this standard well supported by now? I'll change it to 'C' in any case.

> Since this statement is in the book, it would be nice to see Nim programs participating in the online benchmarks game.

I agree, maybe you can convince them to include it: http://benchmarksgame.alioth.debian.org/play.html#languagex :)

> A little misleading or perhaps just incorrect to place a No in C++'s box for metaprogramming. Entire books have been written on C++ metaprogramming.

Somebody else raised this point. Will correct.

Hope this helps!

Re: Show HN: “Nim in Action” is now available

#124
post #123

My questions! I have never written a line of Nim but am enticed: >Nim allows you to use snake_case even if the identifier has been defined using camelCase, and vice versa. Can you also just write it all lowercase, and same synonym effect? i.e. snakecase > The default garbage collector is real-time so it allows you to specify the amount of time it should spend on collecting memory. Since Nim compiles to C, which is no…

Hello, thank you for the questions and feedback! > Can you also just write it all lowercase, and same synonym effect? i.e. snakecase Yes, the first character is case sensitive, but the rest is not. foobar == fooBar == foo_bar == foo_Bar but FooBar != fooBar. > Since Nim compiles to C, which is not garbage collected, does Nim just automatically add its own C-based GC library behind the scenes (no small task), or is it…

>> Not true any more for C++, since the new C++ standard 5 years ago, which contains cross-platform standard library tools for multithreading.

>Is this standard well supported by now? I'll change it to 'C' in any case.

The standard is 5 years old this year and nearly every major compiler has supported it for years, and the big ones supported it before the standard was officially in place. So changing it to C would be much more accurate.

That's not to say that each platform's unique tools, i.e. Apple's own GCD for multithreading, are not still available and widely-used. But C++ lets you not worry about platform-specific multithreading any more, and it's quite nice! In addition to multithreading primitives in the standard, there are also higher-level task-based tools like futures and promises that are cross-platform also.

Re: Show HN: “Nim in Action” is now available

#125
post #123

My questions! I have never written a line of Nim but am enticed: >Nim allows you to use snake_case even if the identifier has been defined using camelCase, and vice versa. Can you also just write it all lowercase, and same synonym effect? i.e. snakecase > The default garbage collector is real-time so it allows you to specify the amount of time it should spend on collecting memory. Since Nim compiles to C, which is no…

Hello, thank you for the questions and feedback! > Can you also just write it all lowercase, and same synonym effect? i.e. snakecase Yes, the first character is case sensitive, but the rest is not. foobar == fooBar == foo_bar == foo_Bar but FooBar != fooBar. > Since Nim compiles to C, which is not garbage collected, does Nim just automatically add its own C-based GC library behind the scenes (no small task), or is it…

>Nim adds its own Nim-based GC library behind the scenes. In fact, it supports multiple GCs (which can be changed via the --gc flag).

I will be spending some time reading about this, since it's definitely the most disruptive aspect to Nim, considering that GC in a systems language is not a "solved problem" in general. Coming from C and C++ I'd most need to know exactly how the GC was working to be comfortable with the idea.

Re: Show HN: “Nim in Action” is now available

#126
post #114
post #102

Earlier quoted context omitted.

I think that you make a good point, there will likely be a fair amount of readers asking those questions.

I think the chapter has a good overview of other language comparisons, but the final table should probably include a few others like D and OCaml (and if you're including those you should also include Lisp via SBCL and Racket..) and stress that for Nim the GC is not only "Yes, multiple" but also optional/bypassable, which is of great importance to C/C++ people. Maybe an appendix for more details / more languages? Rust…

Thank you for this very thorough review :)

I agree with many of your points and I will do my best to incorporate them into my book.

The reason I have compared Nim to Python so heavily is for two reasons:

1) I used to be a Python programmer and chose Nim as a replacement.

2) I see a lot of Python programmer's trying out Go and saying describing it as a "better, faster Python". Perhaps that is just a HN illusion. I in turn believe that Nim is far closer to Python than Go will ever be. I am trying to show people that. Perhaps I should be comparing Nim to Go more as well.

Your list of hooks is brilliant. It's hard for someone like me to remember features which make Nim unique since I use it almost every day, so these are really useful. I will see about mentioning some more of those things, in order to hopefully grab more people's attention!

I have heard of Pony but have not had a chance to try it out. Looks promising.

> Another nitpick, in the section on functional programming, why use var instead of let? The immutability story is just as important as first class functions... And you're missing the item (->) in the list of things the modules were imported for...

Will fix, thank you! I have started out using 'var' then changed everything to 'let' (where appropriate), must have missed that one.

Thanks again!

Re: Show HN: “Nim in Action” is now available

#127
post #123

Earlier quoted context omitted.

Hello, thank you for the questions and feedback! > Can you also just write it all lowercase, and same synonym effect? i.e. snakecase Yes, the first character is case sensitive, but the rest is not. foobar == fooBar == foo_bar == foo_Bar but FooBar != fooBar. > Since Nim compiles to C, which is not garbage collected, does Nim just automatically add its own C-based GC library behind the scenes (no small task), or is it…

>> Not true any more for C++, since the new C++ standard 5 years ago, which contains cross-platform standard library tools for multithreading. >Is this standard well supported by now? I'll change it to 'C' in any case. The standard is 5 years old this year and nearly every major compiler has supported it for years, and the big ones supported it before the standard was officially in place. So changing it to C would be…

Nice! C++'s standards committee did a good job of making sure C++ stayed current :)

Re: Show HN: “Nim in Action” is now available

#128
post #127

Earlier quoted context omitted.

>> Not true any more for C++, since the new C++ standard 5 years ago, which contains cross-platform standard library tools for multithreading. >Is this standard well supported by now? I'll change it to 'C' in any case. The standard is 5 years old this year and nearly every major compiler has supported it for years, and the big ones supported it before the standard was officially in place. So changing it to C would be…

Nice! C++'s standards committee did a good job of making sure C++ stayed current :)

And it continues, major enhancements are abounding. C++17 introduces cross-platform network and socket interactions as part of the standard, among other goodies.

Re: Show HN: “Nim in Action” is now available

#129
post #123

Earlier quoted context omitted.

Hello, thank you for the questions and feedback! > Can you also just write it all lowercase, and same synonym effect? i.e. snakecase Yes, the first character is case sensitive, but the rest is not. foobar == fooBar == foo_bar == foo_Bar but FooBar != fooBar. > Since Nim compiles to C, which is not garbage collected, does Nim just automatically add its own C-based GC library behind the scenes (no small task), or is it…

>Nim adds its own Nim-based GC library behind the scenes. In fact, it supports multiple GCs (which can be changed via the --gc flag). I will be spending some time reading about this, since it's definitely the most disruptive aspect to Nim, considering that GC in a systems language is not a "solved problem" in general. Coming from C and C++ I'd most need to know exactly how the GC was working to be comfortable with th…

This Forum thread in particular should answer some questions: http://forum.nim-lang.org/t/1122

There are also many others: https://www.google.co.uk/search?q=garbage+collector+gc+site:...

Also, feel free to ask questions about the GC in the Nim forum or on IRC. That way other Nim developers can chip in and offer better answers than I ever could :)

Re: Show HN: “Nim in Action” is now available

#130

Earlier quoted context omitted.

Can't anybody from the rust community take over this site? Creating a completely new site might be a fallback, but arewewebyet is referenced / linked very often and ranks high. https://github.com/teepee/arewewebyet looks abandoned.

We have tried but the author has not gotten back the few times we've tried. Tried again today, check the issues there.

Can you say something about those points? I mean there aren' many...

HTTP Server? DB Drivers? Frameworks? E-Mail?

I mean on Node.js I use Hapi (+a few plugins) and Sequelize, which does pretty much everything for me. I would guess, that everything besides the DB drivers is available in Rust too...

Post reply on HN