Skip to content(if available)orjump to list(if available)

Neut Programming Language

Neut Programming Language

18 comments

·February 24, 2025

sestep

For "How Fast is This?" it links to a benchmarks page, which only shows that it's faster than Haskell. It would be more informative to instead compare against a language that is more popular and/or more performant than Haskell.

gnabgib

Big in 2020 as a Show HN (456 points, 80 comments) https://news.ycombinator.com/item?id=23283880

dang

Thanks! Macroexpanded:

Show HN: A dependently-typed programming language with static memory management - https://news.ycombinator.com/item?id=23283880 - May 2020 (78 comments)

I'll see if I can email the author.

sirwhinesalot

The Koka language uses a similar approach to track resource usage, except there they use ref counting and just remove unnecessary ref counting operations. Neat stuff.

fuzztester

It looks partly like OCaml, with the "let ... in" kind of syntax. Also the "unit" word. I think in OCaml it means a function that doesn't return any value, but why is the word unit used for that?

zamalek

It's more precise to think of unit as an empty tuple. A tuple is like an ad-hoc struct without names for the fields, so `(int, string)` is like `struct MyTuple { int a; string b; }`. An empty tuple would be `()` (which is the syntax for unit in many languages), meaning `struct MyTuple {}`. If you think about it, that's about the closest you can get to "nothing" without invoking type system handwavium (like void, which is basically "unit without the good parts but that can also mean anything").

You can do clever stuff with it, for example `HashMap<string, ()>` is practically identical to `HashSet<string>` (depending on how clever the compiler is, possibly actually identical).

chills

I don't think it's particularly useful to think of unit as an empty tuple specifically, that is just an arbitrary but convenient definition for it.

Really a unit type is just one that contains only a single value. This is a unit in the same way that 1 is a unit for the integers. With some hand waving it is an identity for product types, for example (int, ()) is the "same" (xxxmorphic yada yada) as int

winwang

Mildly disagree with your first statement. Well, I mostly agree that it's not particularly helpful for newcomers.

As a 0-tuple, it becomes a specific case of a more general concept -- there is some beauty/usefulness in not having to have a "special" construct for "Unit", which is (in a sense) not just "any" unit type. It also "justifies" the syntax of `()` and notes that it is a product type, all the while fitting into the idea of the "cardinality" of `(a1, a2, ..., an)` being the product of the cardinalities of each of its type params.

chris_pie

It's a standard practice in functional languages: https://en.wikipedia.org/wiki/Unit_type

skulk

I'm currently reading through the automatic memory management claims which look really cool (reminds me of linear types), but the highlighted punctuation (, : =) makes it very painful to read.

layer8

Syntax highlighting of the background color is weird. It makes everything look like surrounded by a halo.

null

[deleted]

tempodox

As a matter of personal preference, hoisted curlies drive me insane.

adrian_b

Obviously the personal preferences about code formatting vary a lot among programmers and it is impossible to reach unanimity.

For instance, I am among those who are annoyed when seeing lines of text wasted with the opening curly brace, reducing thus the number of useful text lines visible on the screen.

Probably it is best to use an automatic code formatter and format the code according to personal preferences while working with it and then reformat it according to project rules when committing the code to the repository.

mindcrime

> For instance, I am among those who are annoyed when seeing lines of text wasted with the opening curly brace,

Conversely, I'm one of the people who are annoyed when the tokens that represent a block of code don't form a vertical line, making it much harder to see "at a glance" where blocks begin and end.

> Probably it is best to use an automatic code formatter and format the code according to personal preferences while working with it and then reformat it according to project rules when committing the code to the repository.

At the end of the day, I'm convinced there is no "right" way to do this. Everybody has their preferences, and who's to say that one set of preferences is objectively more meaningful than another? You care about wasted vertical space, I don't. I care about tokens lining up, you (probably?) don't (at least not as much as I do). But neither of us is really "right" or "wrong".

layer8

What are “hoisted curlies”?

stronglikedan

If I had to guess, it's putting the opening curly bracket on the same line as the function definition, instead of the next line. And if I'm correct, then I also agree.

patrickmay

Allman style FTW!