this post was submitted on 19 Jul 2024
27 points (93.5% liked)

Linux

5187 readers
152 users here now

A community for everything relating to the linux operating system

Also check out !linux_memes@programming.dev

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

founded 1 year ago
MODERATORS
top 6 comments
sorted by: hot top controversial new old
[–] dinckelman@lemmy.world 5 points 3 months ago

I’ve swapped to Lix on my laptop, and my only complaint so far is that you have to be on unstable to install it

[–] CJJackson@programming.dev 3 points 3 months ago

That interesting, I like the fact they replacing C++ with Rust, but I'd wait until Arch Linux has a 'Lix' package :)

[–] FizzyOrange@programming.dev -1 points 3 months ago (2 children)

Are they going to make the language less... academic. I mean there is a fair amount of word syntax from functional languages that make it not very accessible for the average programmer. For example: let x=y in instead of just let x=y;. Functions declared like {a, b}: a + b which is very unusual syntax - I don't see why you couldn't use JS-style arrow syntax.

It seems like they have almost gone out of their way to deviate from syntax that most developers would already understand, and who wants to spend time learning new syntax for a build system? Not me.

Contrast that with Starlark which is admittedly less elegant but also I had to spend zero time learning a new language to use it.

[–] demesisx@infosec.pub 9 points 3 months ago

I’m an absolute dumbass and even I had zero issues with Nixlang.

[–] murtaza64@programming.dev 2 points 3 months ago* (last edited 3 months ago) (1 children)

Nix being an expression based functional language, it doesn't really make sense to have something like let x=y; since this looks to most people like a statement (i.e. a line of code that gets executed as part of a sequence). This doesn't exist in nix—instead you have expressions that get lazily evaluated, possibly out of order compared to what you'd expect. let x=y in makes it more clear that the variable binding you're doing is only in scope for the current expression, which reads something like "let x refer to y in x + 3"

The function definition syntax is unusual but definitely not unintuitive imo. It captures the simplicity of the function semantics of nix—a function is just a mapping/transformation from one value (or set of values) to another. I don't think it's too much overhead to learn that they use : to mean this instead of =>

In terms of why they picked this syntax, it follows the traditions of other functional languages such as the ML family, Haskell etc.

[–] FizzyOrange@programming.dev 0 points 3 months ago

Nix being an expression based functional language, it doesn’t really make sense to have something like let x=y; since this looks to most people like a statement

I know of several languages that just have let x=y; <expr> as an expression. It works fine, it's just more obvious syntax.

The fact that it looks like a statement is kind of the point.

it follows the traditions of other functional languages such as the ML

OCaml at least supports both forms. They didn't have to pick the weird one.