Live data from Hacker News

Show HN: “Nim in Action” is now available

nim-lang.org

111–120 of 139 posts

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

#111

Earlier quoted context omitted.

I'd be violently allergic to the case insensitivity in a dynamically typed language where you could declare a variable with something like "foo = 1" but I'm fine with it in Nim. EDIT: s/sensitivity/insensitivity/

You are technically correct - the best kind of correct. I agree, but my concern is not correctness, it is aesthetics. Why? Reading a computer program is often harder than writing it from scratch, so I like when languages enforce (or at least encourage) a name convention - just to keep it easier to read. Does Nim have something like PEP-8?

This is also why I don't mind/actively like significant whitespace.

It doesn't matter for my own code because I already write it that way, but it enforces good indenting behavior on others who might otherwise forgo it.

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

#112
post #37
post #19

Could be of interest if the creator didn't self-promote the language through an aggressive tone "after a few beers" https://hero.handmadedev.org/forum/code-discussion/937-i-wou...

Read that discussion. Learned a lot of good things.

Wow, you're right, that's a hidden gem. Thanks for pointing it out.

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

#113
post #107
post #106

Earlier quoted context omitted.

But gdb probably will point to C source line instead of nim's source. That might be a problem.

No, you get Nim source code debugging using line number directives etc, works great including breakpoints and all. I have tested several IDEs and it works. But data inspection does generally not work - that would require some work to support GDB protocols.

Fortunately, GDB is scriptable in Python. The C++ add-ons make life so much easier, no reason it can't be done for Nim.

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

#114
post #102
post #101

Earlier quoted context omitted.

I'm coming at this from a starting point of "I want a fairly safe modern compiled language" - I'm a lot more interested in hearing why I'd choose nim over a similar language than why I'd choose it over e.g. python (which is such a different language that it's hard hard to even begin to compare, IMO). Maybe that's not the same question that a general audience would ask.

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 and D probably deserve more details but anything with a forced GC, probably not... So I second the opinion that perhaps a little too much time is spent comparing with Python, but you're in a much better position to tell how many newcomers to Nim are actually dropping Python just about completely for it. (For me, even though I'm still in the playing stage with Nim, I can already say with certainty Nim won't replace the things I use Python most for already, especially since I'm committed to a preference for dynamic typing over static, and I would argue the sentence on page 17 that "Replacing Python is especially easy because its syntax is so similar to Nim's" is false for any non-trivial Python code...)

The biggest dimensions for me when first evaluating a new language that I might want to learn more about someday are typing (dynamic, untyped, or static, and if static whether that's of the Haskell variety or more mildly anti-certain-class-of-errors-driven plus performance-driven like most other things) and garbage collection (none, forced, or optional). That info helps me immediately bucket what sorts of applications this new language could help me take on in a better way than other languages I know. With Rust, watching it develop I didn't think too highly of their decision to remove the @ sigil (that is, remove the GC from the core language). That's what ultimately made me think of Rust only as something I'll ever try to learn and use if I come across the narrow (in my interests) problem domain of "I absolutely require a Safe program but for some reason I can't use a GC language."

I think your first 12 pages do a pretty good job at highlighting some of the hooks that originally put Nimrod on my watch list whenever ago, though personally I'd put the style insensitivity thing last (and it doesn't cover things like omitting parens for single-arg or no-arg functions but you mix that particular style choice around throughout the chapter). Those hooks, including some you don't really cover yet, are speed (like, at or even sometimes beating C-level speed), all three of optional, tunable, implementation-detail-swappable garbage collector with access to malloc/free or even just embedding C code directly like you might embed ASM code directly in C code, inferred static typing to minimize ceremony, the huge list of pragmas to tell the compiler -- which humbly admits it tries its best but is not all-knowing -- about useful things for performance or other reasons, user-defined compiler demands (not "hints", as it's not optional) to make optimizations via term-rewriting macros, style choices (but sadly no Lisp-like dashes in function names), and an awareness of and support for many higher level language features enjoyed by other languages. No forced main() and whitespace indentation make it immediately comparable to Python on the surface which is a nice bonus (for those that like Python anyway). Taking all these things together, there isn't really a comparable language, or at least not one that's on very many people's radar. I think the only language worth mentioning (or not, per strategy) as one that might surprisingly come up from behind in n years and eat Nim's potential big lunch by then is Pony.

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...

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

#115
post #82
post #53

Earlier quoted context omitted.

well, i dont know if nim have a free book yet, but i would suggest making the ebook free this will encourage students and casuals to look into nim

There is a free manual, free tutorials, core source is free, all Nimble packages are free, free tutorials in blog posts, free first chapter, many free projects..

Plus the book's source code examples will be free. (And, if we're honest, the book itself will be free too on various book-download sites...)

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

#116
post #37

Earlier quoted context omitted.

Read that discussion. Learned a lot of good things.

Wow, you're right, that's a hidden gem. Thanks for pointing it out.

Indeed.. Seems the admin's point of view is "it's all fine and good that your language can manipulate ASTs with ease, but with the mere search-replace support of C (and perhaps other tools that actually try to parse code, can't show anything though or even describe what they do) I've hacked some really awesome things that I want included as already implemented macros or whatever out of the box in your new language to get me to switch." There's a fun quote on Nim's standard library reference page: "The good thing about reinventing the wheel is that you can get a round one."

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

#117
post #33

Earlier quoted context omitted.

may I ask, to do what? I think they don't claim to "be web" yet [0] and I doubt you were using PHP other than serving over http? [0] http://arewewebyet.com/

This website is _extremely_ outdated, please don't take it as accurate.

Sorry, I had no idea. Will update my comment. It's a pity, though. I really liked checking on the status of the latest work for web development in Rust from a single place.

edit: It seems that I can't edit that comment anymore.

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

#118
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…

I also found several items in Pony to be interesting, and Andreas is very aware of Pony. One drawback of Pony is that it is written in C, while Nim is written in Nim. But a lot of the concepts in Pony are worth looking hard at :)

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

#119
post #3

Based on my surface-level understanding of Nim, Go is much more comparable to Nim than it is Rust. I never understood the Rust-Go comparisons, since Rust is a serious systems programming language. I would never use Go or Nim to replace C or C++ usage as I would Rust, but I might use Nim in place of Go or Java. Does anyone with significant Nim experience care to lend some opinions? I don't want to start a flame war--I…

> I never understood the Rust-Go comparisons Historical accident: they started surfacing around the same time, Go was originally described as a systems language (which it never was according to the usual meaning of the term) and Rust had more application-level features (built-in "GC pointer", green threads). As incorrect as it was, the initial… impression? — it's probably the wrong term but I don't have a better one…

> Go was originally described as a systems language (which it never was according to the usual meaning of the term)

Fun fact! Go has roots in the Limbo[0] programming language, which runs in a VM, is garbage collected, has communication channels, and was used to write the Inferno[1] operating system, which is sort of a successor to Plan 9 (which is itself sort of a successor to Unix).

[0] https://en.wikipedia.org/wiki/Limbo_programming_language

[1] http://www.vitanuova.com/inferno/ https://en.wikipedia.org/wiki/Inferno_%28operating_system%29 http://c2.com/cgi/wiki?InfernoOs

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

#120
post #62

Earlier quoted context omitted.

Great! Thing is, Rust and Nim are very different. Just as I wouldn't put Rust down for not having GC (I love languages moving the art forward) I just wish we could look at Nim as a language with different design goals than Rust. I know several things in Nim worth discussing, it doesn't have to be warring.

> 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.

Post reply on HN