!tDnwWRNkmmYtMXfaZl:nixos.org

Nix Language

1692 Members
Nix programming language299 Servers

Load older messages


SenderMessageTime
23 Aug 2025
@grimmauld:grapevine.grimmauld.deGrimmauld (any/all)

Also the repl is screwy:

Lix 2.93.3
Type :? for help.
nix-repl> f = x: 1 + f x
error: undefined variable 'f'
       at «string»:1:12:
            1| f = x: 1 + f x
             |            ^

nix-repl> f = let f' = x: 1 + f' x; in f'
Added f.

nix-repl>

like come on, why do i need a let binding to define recursion in a repl, this is dumb

17:37:00
@emilazy:matrix.orgemilyI think it's nice that you don't have to worry about Nix expressions you import having side effects, and that only the packages you need for the package you want to build are evaluated17:37:14
@emilazy:matrix.orgemilyyou can make a restricted DSL in any language if you really want, but Nix gives you those for free17:37:39
@niklauzg:matrix.orgNiklauzIn part I think what I'm asking is if you're consider that it could be "worthwhile"?17:37:44
@piegames:flausch.socialpiegames
In reply to @grimmauld:grapevine.grimmauld.de

Also the repl is screwy:

Lix 2.93.3
Type :? for help.
nix-repl> f = x: 1 + f x
error: undefined variable 'f'
       at «string»:1:12:
            1| f = x: 1 + f x
             |            ^

nix-repl> f = let f' = x: 1 + f' x; in f'
Added f.

nix-repl>

like come on, why do i need a let binding to define recursion in a repl, this is dumb

Can you file an issue and tag me please?
17:38:30
@grimmauld:grapevine.grimmauld.deGrimmauld (any/all)(ignore this function is missing an anchor, not the point)17:38:37
@qyriad:katesiria.orgQyriadrepl bindings can shadow though17:38:48
@emilazy:matrix.orgemilyI think Guix is a decent enough implementation of "Nix if you wrote the expressions in Scheme"17:38:55
@grimmauld:grapevine.grimmauld.deGrimmauld (any/all)sure can do, its bugged me for a long time already17:39:06
@emilazy:matrix.orgemilybut I would prefer a better Nix-ish language to putting in more or less any other existing language17:39:09
@emilazy:matrix.orgemily the alternative is not being able to x = x + 1 17:39:39
@emilazy:matrix.orgemily ah, as Qyriad said 17:39:50
@grimmauld:grapevine.grimmauld.deGrimmauld (any/all)so there is no good solution because one can't have both?17:41:02
@grimmauld:grapevine.grimmauld.deGrimmauld (any/all) not even something like \noshadow ... to omit the let...in for recursion or something? 17:41:29
@grimmauld:grapevine.grimmauld.deGrimmauld (any/all) * maybe something like \noshadow ... to omit the let...in for recursion or something? 17:41:36
@piegames:flausch.socialpiegamesYes. (The solution to your problem is lib.fix btw)17:41:38
@grimmauld:grapevine.grimmauld.deGrimmauld (any/all) * maybe something like :noshadow ... to omit the let...in for recursion or something? 17:41:59
@niklauzg:matrix.orgNiklauzYeah I'm assuming this wouldn't be an either or situation - that perhaps the improvement to Nix might open up the option to sanely target nix as part of language evolution goal. 17:42:16
@piegames:flausch.socialpiegamesPersonally I'd always prefer shadowing over implicit recursion, but that ship has sailed when I was in Kindergarten, so now the question only is about language consistency17:42:27
@niklauzg:matrix.orgNiklauzbut now I'm just talking to the internet about my dreams 😄 17:42:28
@grimmauld:grapevine.grimmauld.deGrimmauld (any/all)not everything uses nixpkgs lib, but fair enough i guess17:42:55
@grimmauld:grapevine.grimmauld.deGrimmauld (any/all)honestly all shadowing should be banned, its just one big footgun. I want recursion everywhere and now shadows.17:43:41
@grimmauld:grapevine.grimmauld.deGrimmauld (any/all)buuut that might be a bit radical and i am probably missing some detail why we need it17:44:01
@piegames:flausch.socialpiegamesI learned in Haskell that recursion is an equal footgun17:44:56
@qyriad:katesiria.orgQyriad
In reply to @grimmauld:grapevine.grimmauld.de
honestly all shadowing should be banned, its just one big footgun. I want recursion everywhere and now shadows.
the repl and function arguments are the literal only places where things can shadow and imo those are both good places for it
17:45:48
@ebeem:matrix.orgebeem-sama changed their profile picture.19:58:55
@wh1xc:matrix.orgwhixie joined the room.21:25:06
24 Aug 2025
@corridor4572:matrix.orgRichInOverdraft changed their display name from Richman to rich.04:10:47
@uvla:matrix.orguvla joined the room.12:51:43
25 Aug 2025
@mjolnir:nixos.orgNixOS Moderation Bot banned @srid:matrix.org@srid:matrix.org (<no reason supplied>).08:17:23

Show newer messages


Back to Room ListRoom Version: 6