<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
<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.