4 ms·
I write regexes all the time, and I don't know if I would be CHALLENGED by that, but it would be annoying. Escaping things is trivial, and since you do it all t
by cortesoft 3y ago
I write regexes all the time, and I don't know if I would be CHALLENGED by that, but it would be annoying. Escaping things is trivial, and since you do it all the time it is not anything extra to learn. Having to remember bespoke keystrokes for each character is a lot more to learn.
- keybored 3y agoASCII restriction begets ASCII toothpick soup. Either lift that restriction or use balanced delimiters for strings in ASCII like backtick and single quote. (“But backtick is annoying to type” said the Europeans.)
- int_19h 3y agoRegexes are one case where I think it's already extremely unbalanced wrt being easy to write but hard to read. Using stuff like special Unicode chars for this would make them harder to write but easier to read, which sounds like a fair deal to me. In general, I'd say that regexes should take time and effort to write, just because it's oh-so-easy to write something that kinda sorta works but has massive footguns. I would also imagine that, if this became the norm, IDEs would quickly standardize around common notation - probably actually based on existing regex symbols and escapes - to quickly input that, similar to TeX-like notation for inputting math. So if you're inside a regex literal, you'd type, say, \A, and the editor itself would automatically replace it with the Unicode sigil for beginning-of-string.
- emporas 3y agoRegexes originate from Perl, or they were popularized by Perl if i got this right. In Perl readable code is not ranked as one of it's top 100 priorities. Regexes could originate from J and situation could be even worse though!
- TristanBall 3y agoRegex's predate perl quite substantially. Think grep and friends if nothing else. Certainly making the perlre library available separate to perl encouraged its widespread use, and lots of others copied or were inspired by it. "Popularized" doesn't seem like quite the right word though, I don't disagree with the point, but if I shout "Hey everyone let's write regex's" at the office people throw stationary at me, which is not true of other popular things!
- wlonkly 3y agoPerl spread regexes.
- emporas 3y agoSuper spreader event we've got ourselves into. I took a look at Raku, which claims be a better Perl maybe, or closely related but more modern, it certainly looks nice. Although i am a big fan of typed languages, Raku piqued my interest.
- lizmat 3y agoIn Raku, if you want to go typed, you can! It's called "gradually typed". my Int $a = 42; # ok my Int $a = "foo"; # Type check failed in assignment to $a; expected Int but got Str ("foo")
- emporas 3y agoVery nice, good to know. Yes i know gradual typing, Python has a form of that i think. I will check out Raku at some point, the type system will not go unnoticed. I didn't even know it had one!