!9IQChSjwSHXPPWTa:lix.systems

Lix

1101 Members
Lix user channel. Feel free to discuss on-topic issues here and give each other help. For matrix.to links to the rest of the Lix channels, see: https://wiki.lix.systems/books/lix-organisation/page/matrix-rooms292 Servers

Load older messages


SenderMessageTime
15 Nov 2025
@347online:matrix.orgKatie 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:asf.computerantifuchs“Truthy”18:41:42
@aloisw:julia0815.dealoisw 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
@347online:matrix.orgKatieit could "compile" to an attrset18:41:50
@k900:0upti.meK900 But like, how would it be different from "foo" then 18:42:09
@antifuchs:asf.computerantifuchsGotta love using a language made when truthiness and falsiness was still considered socially ok18:42:11
@aloisw:julia0815.dealoisw What's so cursed about this? 18:42:15
@k900:0upti.meK900 It returns a conventionally falsy value for both match and no match 18:42:46
@347online:matrix.orgKatie and have /foo/.match be essentially syntax sugar for builtins.match /foo/.source 18:42:37
@k900:0upti.meK900FOr one18:42:48
@k900:0upti.meK900* For one18:42:50
@aloisw:julia0815.dealoisw In what sense is the empty list "conventionally falsy"? 18:43:22
@k900:0upti.meK900 In the any other language but Nix sense 18:43:56
@347online:matrix.orgKatieempty list is truthy in JS18:44:50
@aloisw:julia0815.dealoisw That's straight up not going to work because /foo/.match is a path literal. And yes, you could make it work with a space, but at the cost of introducing another footgun if the user forgets that space. 18:45:01
@347online:matrix.orgKatie which I think why no match returns null 18:45:05
@k900:0upti.meK900I said language18:45:30
@k900:0upti.meK900Not eldritch abomination18:45:30
@347online:matrix.orgKatieMMMM... got it, yes, that is a problem18:45:37
@347online:matrix.orgKatiemaybe (/foo/).match18:45:50
@347online:matrix.orgKatieor maybe a different bookend token18:46:10
@347online:matrix.orgKatie|foo|18:46:18
@antifuchs:asf.computerantifuchsEmpty list is falsy in the originator of the meme, lisp (fixed in scheme though); still not sure I love it there18:46:21
@aloisw:julia0815.dealoisw It's quite reasonable given how builtins.match semantics work. Unmatched capture groups give null, matched capture groups give the list of its submatches. 18:46:31
@aloisw:julia0815.dealoisw Same problem of being a footgun if the user leaves off the seemingly redundant parenthesis. 18:47:00
@347online:matrix.orgKatieYeah, I don't love the parentheses idea18:47:24
@aloisw:julia0815.dealoisw Like I don't see the point of syntactic sugar that makes an uncommon operation look slightly shorter at the cost of adding massive footguns. 18:47:29
@347online:matrix.orgKatieI don't know how convincing it will be to you, but I can try to offer my perspective there on the appeal for me18:48:38
@347online:matrix.orgKatie I have... god only knows what kind of dyslexia-adjacent cognitive bullshit going on in addition to my really crappy vision. RegEx literals being their own unique semantic construct unto themselves that IDEs can differentiate and color/highlight as such is a HUGE benefit to me. I'm loathe to praise JavaScript for almost anything, but RE literals are a huge win for me there that I really miss when writing say, Rust. I find Nix Path Literals exceptionally ergonomic for very similar reasons. It just helps me see and understand much more clearly what I'm looking at, vs. just another string 18:53:25
@347online:matrix.orgKatie
  • shorter is nice too
18:54:10

Show newer messages


Back to Room ListRoom Version: 10