infinisil changed the topic of #nix-lang to: Channel for discussing Nix as a language - https://nixos.org/nix/manual/#chap-writing-nix-expressions - Logs: https://logs.nix.samueldr.com/nix-lang/
noonien has quit [Quit: Connection closed for inactivity]
ddellacosta has joined #nix-lang
hmpffff has joined #nix-lang
hmpffff has quit [Ping timeout: 240 seconds]
ddellacosta has quit [Ping timeout: 256 seconds]
hmpffff has joined #nix-lang
hmpffff_ has joined #nix-lang
hmpffff has quit [Ping timeout: 256 seconds]
__monty__ has joined #nix-lang
WilliButz has quit [Remote host closed the connection]
WilliButz has joined #nix-lang
andi- has quit [Remote host closed the connection]
andi- has joined #nix-lang
ddellacosta has joined #nix-lang
<infinisil> Umm
<infinisil> > builtins.match "[+-.]" ","
<{^_^}> [ ]
<infinisil> This matches
<infinisil> > builtins.match "[+-.]" "a"
<{^_^}> null
<infinisil> > builtins.match "[+-]" ","
<{^_^}> null
<infinisil> > builtins.match "[-.]" ","
<{^_^}> null
<infinisil> > builtins.match "[+.]" ","
<{^_^}> null
<infinisil> These all don't... The hell??
<ekleog> `[+-.]` means all the chars with an ascii code between + and .
<ekleog> ie. + , - .
<infinisil> Ohh damn
<infinisil> Wait and [^+-.] then means all ascii codes outside that range?
evanjs has quit [Quit: ZNC 1.7.5 - https://znc.in]
<infinisil> Damn yeah
<infinisil> Why did I think otherwise for all this time??
<infinisil> Ahhh!
<infinisil> The "-" indicates this range
<infinisil> Which is why A-Z works
<infinisil> Now it all makes sense
evanjs has joined #nix-lang
<infinisil> Okay but how do I escape the "-" then?
<infinisil> > builtins.match "[+\\-.]" ","
<{^_^}> invalid regular expression '[+\-.]', at (string):293:1
<infinisil> Ah, I could just put the - first or last
<infinisil> > builtins.match "[+.-]" ","
<{^_^}> null
<__monty__> > builtins.match "[+\-.]" ","
<__monty__> > builtins.match "[+\-.]" ","
<{^_^}> [ ]
<__monty__> Huh, it escapes the - but it still means range?
<__monty__> > builtins.match "[+\-.]" "\\"
<{^_^}> null
<__monty__> 🤨
<puck> yeah
<puck> err
<puck> nix escapes are *fucked*
<puck> > "\-"
<{^_^}> "-"
<puck> this should probably just be banned
ddellacosta has quit [Ping timeout: 256 seconds]
<__monty__> That escape is fine but parsing - as a character range shouldn't happen if the - is escape.
<__monty__> *escaped
<puck> no, the escape is not fine
<puck> if any unrecognized escape is used, it should not just pass on the next character
<puck> because that's a backcompat nightmare
<puck> if you do that' you can't ever add more escape sequences
<puck> e.g. "\x02"
<__monty__> What do you mean? Most languages allow you to escape characters like that. Backslash is simply dropped unless it's a valid escape code and any other processing of the character is prevented.
<puck> error: unknown character escape: h
<puck> reimu ~> rustc test.rs
<__monty__> Afaik most languages just follow C in this regard.
<__monty__> How often do language designers add escape sequences anyway?
<puck> escape codes in C must be understood, or else they at least throw a warning
<puck> i mean, nixpkgs already depends on evaluator bugs anyways
<puck> > let a = { a = a; }; b = { a = b; }; in a == b
<{^_^}> error: stack overflow (possible infinite recursion)
<puck> lmao
<infinisil> That makes sense to me
<adisbladis> My "favourite" nix evaluator bug is that the regex engine is different on macos and linux -.-
<adisbladis> That issue keeps biting me over and over again
<infinisil> adisbladis: Oh that reminds me of the bug where between (and including) Nix versions 2.1 to 2.2.2, invalid regex sequences like "\\" were accepted. Not before and not after.
<adisbladis> Good grief
ddellacosta has joined #nix-lang
edef has quit [Quit: leaving]
edef__ has joined #nix-lang
edef__ is now known as edef
adisbladis has quit [Quit: ZNC 1.7.5 - https://znc.in]
ddellacosta has quit [Quit: WeeChat 2.2]
ddellacosta has joined #nix-lang
__monty__ has quit [Quit: leaving]
ekleog has quit [Quit: WeeChat 2.6]
ekleog has joined #nix-lang