Live data from Hacker News

Nim 2.0

nim-lang.org

61–70 of 213 posts

Re: Nim 2.0

#61

Earlier quoted context omitted.

1. Nim uses 'var' modifier to pass by reference, e.g. "proc (n: var int)...", default behaviour is pass by value. And there're also raw pointers and references (safe pointers). >is a no-gc mode available? You can disable gc, but most of standard library depends on it. But in Nim 2.0 there's finally support for ARC and ORC (ARC + cycle collector).

I've been searching and can't find it: A in ARC is for automatic, what does the O stand for?

O is a visual pun because it adds a cycle collector to ARC.

Re: Nim 2.0

#62
If someone at Manning Publications is reading this, it would be great to have a book on the newer Nim version, but please consider using a different typesetting with more readable fonts. I purchased the great book by Dominik Picheta, but am forced to use the .pdf because the dead tree version uses thin fonts that I find extremely hard to read even with the right pair of glasses. Font components (arms, lines, stems, etc) are just too thin. Not being a youngster anymore, I naturally thought it was my fault and took the original K&R 2nd ed as a comparison, but still can read it perfectly.

Re: Nim 2.0

#63

Congratulations to everyone involved and the entire Nim community! Nim has been my language of choice for the past decade and I'm really happy with the new features in Nim 2.0. Some of them are real gamechangers for my projects. For example, default values for objects theoretically allow me to make Norm[1] work with object types along with object instances. And the new overloadable enums is something Karkas [2] would…

Of all the recent changes, default values is my favorite. Aside from generally useful and further reducing the need for initialisation boilerplate, I lets us guarantee valid state at compile time for things like enums - and, I assume, object variants?

Re: Nim 2.0

#65
post #24

Seems like it kinda has Sum Types, so Nim passes the litmus test for respectable static type-system in this day and age. https://nim-lang.org/docs/manual.html#types-object-variants

I feel the same way as you! I've seen many language ideas come and go in my career and sum types are one I feel now should be a basic requirement. I miss them in any language without them.

Re: Nim 2.0

#66
post #45
post #38

Earlier quoted context omitted.

Sounds like a vector/array/list in any other language after C++, like Go slice, Java ArrayList, Javascript array, Python list, Rust vec. Is there something I'm missing?

I think they're discussing the lifetime of that heap data, not whether the data is heap allocated.

I don't see them drawing any distinctions from C++ or Rust there either. It really sounds to me like most of their low-level experience is in C, where the contrasts they appear to be drawing really do apply.

Re: Nim 2.0

#67
The last time I used the language, it was still using a garbage-collector and there were talks about transitioning towards a new way of doing things - I assume that ARC/ORC ended up being that destination.

Now that ARC/ORC is considered "complete," are there any remnants of the old GC still in the language, or has the entire ecosystem hopped over?

Re: Nim 2.0

#68

What are some noteworthy projects or libraries written in Nim?

We have written pixie: https://github.com/treeform/pixie . Pixie is a 2D graphics library similar to Cairo and Skia written entirely in Nim. Which I think is a big accomplishment. It even has python bindings: https://pypi.org/project/pixie-python/

Re: Nim 2.0

#69

If your Python programs heavily use Pandas and Numpy, could there still be speed benefits to translating them to Nim?

Following up on this: As someone who uses Python with NumPy/SciPy heavily, are there any Nim libraries that would make the transition smooth? Libraries that can help with e.g. sparse matrices, linear algebra, differential equations, etc.

Re: Nim 2.0

#70
post #67

The last time I used the language, it was still using a garbage-collector and there were talks about transitioning towards a new way of doing things - I assume that ARC/ORC ended up being that destination. Now that ARC/ORC is considered "complete," are there any remnants of the old GC still in the language, or has the entire ecosystem hopped over?

For most of us the move from GC to Orc is pretty transparent. Most libraries just work and don't require any major restructuring.
Post reply on HN