| 15 Nov 2025 |
522 it/its ⛯ΘΔ | i assume url literals were at least checked for validity? | 18:37:15 |
K900 | Not really | 18:37:23 |
K900 | And "validity" for URLs is a very nebulous concept anyway | 18:37:32 |
aloisw | nix-repl> /foo/ bar
error: path has a trailing slash
at «string»:1:6:
1| /foo/ bar
| ^
surprisingly enough that syntax is free | 18:37:36 |
522 it/its ⛯ΘΔ | /foo[/ should fail to evaluate, at least | 18:37:40 |
K900 | Most things you would not expect to be valid URLs actually are | 18:37:41 |
Katie | ...this is roughly what I imagined, but you do make a good point 😅 | 18:37:44 |
aftix | you can write regex in '' to avoid double backslashing already? | 18:37:54 |
K900 | Yeah I think the question here really is, what kind of semantics do you want | 18:38:07 |
K900 | And also why | 18:38:09 |
aloisw | Well it's pretty much exactly what happened with URL literals, I didn't make it up from scratch. | 18:38:27 |
K900 | Because the concept of naked function shaped literals gives me an ick | 18:38:28 |
K900 | Not to mention you'd probably have to do cursed things with operator precedence to make it make any level of sense | 18:38:56 |
522 it/its ⛯ΘΔ | that and you might want to do things that aren't just matching, so it does need to be more powerful than just a function | 18:39:00 |
K900 | Well it would return whatever the fuck builtins.match returns already | 18:39:30 |
522 it/its ⛯ΘΔ | oh does match allow capture groups | 18:39:43 |
K900 | Yes | 18:40:06 |
aftix | in JS, the regex syntax creates a RegExp object, but in nix regexes are just strings anyways | 18:40:09 |
K900 | In an exceptionally cursed way | 18:40:09 |
K900 | nix-repl> builtins.match "a" "a"
[ ]
nix-repl> builtins.match "(a)" "a"
[ "a" ]
nix-repl> builtins.match "a" "b"
null
| 18:40:37 |
522 it/its ⛯ΘΔ | ah funny | 18:40:53 |
K900 | Not the word I'd use | 18:41:01 |
Katie | I was thinking you could pass /foo/ as the first argument to builtins.match, but I suppose if we continue looking at JavaScript, you could do builtins.match /foo/.source | 18:41:39 |
antifuchs | “Truthy” | 18:41:42 |
aloisw | More that it simply doesn't really have regexes at all and just offers some builtins that parse the regex at runtime. | 18:41:42 |
Katie | it could "compile" to an attrset | 18:41:50 |
K900 | But like, how would it be different from "foo" then | 18:42:09 |
antifuchs | Gotta love using a language made when truthiness and falsiness was still considered socially ok | 18:42:11 |
aloisw | What's so cursed about this? | 18:42:15 |
K900 | It returns a conventionally falsy value for both match and no match | 18:42:46 |