zlacker

Nimony (Nim 3.0) Design Principles

submitted by andsoi+(OP) on 2025-12-02 00:39:41 | 148 points 93 comments
[view article] [source] [go to bottom]

NOTE: showing posts with links only show all posts
◧◩◪
22. cb321+L7c[view] [source] [discussion] 2025-12-05 15:15:06
>>kace91+pYb
There is no direct argument/guidence that I saw for "when to use them", but masked arrays { https://numpy.org/doc/stable/reference/maskedarray.html } (an alternative to sentinels in array processing sub-languages) have been in NumPy (following its antecedents) from its start. I'm guessing you could do a code-search for its imports and find arguments pro & con in various places surrounding that.

From memory, I have heard "infecting all downstream" as both "a feature" and "a problem". Experience with numpy programs did lead to sentinels in the https://github.com/c-blake/nio Nim package, though.

Another way to try to investigate popularity here is to see how much code uses signaling NaN vs. quiet NaN and/or arguments pro/con those things / floating point exceptions in general.

I imagine all of it comes down to questions of how locally can/should code be forced to confront problems, much like arguments about try/except/catch kinds of exception handling systems vs. other alternatives. In the age of SIMD there can be performance angles to these questions and essentially "batching factors" for error handling that relate to all the other batching factors going on.

Today's version of this wiki page also includes a discussion of Integer Nan: https://en.wikipedia.org/wiki/NaN . It notes that the R language uses the minimal signed value (i.e. 0x80000000) of integers for NA.

There is also the whole database NULL question: https://en.wikipedia.org/wiki/Null_(SQL)

To be clear, I am not taking some specific position, but I think all these topics inform answers to your question. I think it's something with trade-offs that people have a tendency to over-simplify based on a limited view.

◧◩◪
52. cb321+YBc[view] [source] [discussion] 2025-12-05 17:17:42
>>naller+xjc
The only way to really test out a programming language is by trying it out or reading how someone else approached a problem that you're interested in/know about.

There are over 2200 nimble packages now. Maybe not an eye-popping number, but there's still a good chance that somewhere in the json at https://github.com/nim-lang/packages you will find something interesting. There is also RosettaCode.org which has a lot of Nim example code.

This, of course, does not speak to the main point of this subthread about the founder but just to some "side ideas".

◧◩
53. SJMG+TCc[view] [source] [discussion] 2025-12-05 17:21:14
>>esafak+uTb
Not a defense of the poison value approach, but in this thread Araq (Nim's principal author) lays out his defense for exceptions.

https://forum.nim-lang.org/t/9596#63118

◧◩
57. SJMG+ALc[view] [source] [discussion] 2025-12-05 18:00:03
>>ninjaq+wFc
Yes

Design: https://github.com/nim-lang/RFCs/issues/559

Plan: https://forum.nim-lang.org/t/13357#81170

◧◩◪◨⬒⬓
74. umanwi+gqd[view] [source] [discussion] 2025-12-05 21:09:57
>>Mond_+ygd
Indeed this isn't anywhere in the Rust standard library, but there is `ordered_float::NotNan`: https://docs.rs/ordered-float/latest/ordered_float/struct.No... .

Unfortunately, Rust doesn't seem to be smart enough to represent `Option<NotNan<f64>>` in 8 bytes, even though in theory it should be possible (it does the analogous thing with `Option<NonZero<u64>>`).

This thread is discussing the possibility of adding such an optimization: https://internals.rust-lang.org/t/add-float-types-with-niche...

◧◩◪
80. matche+wOd[view] [source] [discussion] 2025-12-05 23:36:55
>>SJMG+ALc
Interesting.

I wonder how Nim 3/Nimony handles or will handle bindings in patterns regarding copy, move or reference. Rust can change it per binding, and Ada's experimental pattern matching might have some plans or properties regarding that.[1]

> By default, identifier patterns bind a variable to a copy of or move from the matched value depending on whether the matched value implements Copy.

> This can be changed to bind to a reference by using the ref keyword, or to a mutable reference using ref mut. For example:

    match a {
        None => (),
        Some(value) => (),
    }

    match a {
        None => (),
        Some(ref value) => (),
    }
.

The Github issue had a strange discussion. I really disliked goteguru's equals-sign-based syntax, though I had difficulty judging the main design syntax.

I wonder what Araq thinks of Scala's Expression AST type. Tree, TermTree, and all the subtype case classes [2]. Tree has fields. Though I am not certain how the common variables are initialized.

[1] https://doc.rust-lang.org/reference/patterns.html#r-patterns...

[2] https://github.com/scala/scala3/blob/main/compiler/src/dotty...

[go to top]