736
average day in NPM land (programming.dev)
you are viewing a single comment's thread
view the rest of the comments
[-] ChaoticNeutralCzech@feddit.org 5 points 1 month ago* (last edited 1 month ago)

You are right, "elf" is a stretch, it does not make sense to parse it as a number. But in some languages, the string "15 240,5" is just how a number is written (yes, that's a U+2009 THIN SPACE, you can't stop me from using it as a thousand separator in German). Obviously, despite having a , on their numpads, German programmers still expect computers to parse numbers with decimal dots and interpret commas as list values.

[-] bitfucker@programming.dev 4 points 1 month ago* (last edited 1 month ago)

Alright, maybe you misunderstood the term digits with numbers. When parsing a digit, you do not attach semantic yet to the building blocks. A \d regex parser does not care that the string "555" is not equivalent to "VVV". All it cares about is that there is the digit "5" or "V". In the same vein, regex parser should not try to parse IV as a single symbol.

[-] ChaoticNeutralCzech@feddit.org 3 points 1 month ago* (last edited 1 month ago)

It's not just digits. Nobody is expecting it to understand language yet but the parser is-number still returns true for "2e3" or "0x0F". It tells you whether the string can be interpreted as a real numeric value.

[-] bitfucker@programming.dev 1 points 1 month ago

Yeah, hence is-"number". But we were talking about regex are we. A number representation can use digits but it can also not. Much like how you make a number using the word "elf".

[-] Aqarius@lemmy.world 2 points 1 month ago

I feel like there shoul be an ISO/DIN to define this.

this post was submitted on 31 Jul 2024
736 points (99.3% liked)

Programmer Humor

19187 readers
1180 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS