Any remotely capable IDE will immediately show you what, and where, the problem is.
Pure Evil
Submitted 9 months ago by realitista@lemmy.world to programmer_humor@programming.dev
https://lemmy.world/pictrs/image/34a6b0f4-6ad3-432b-84f1-ff59a34d9b4b.jpeg
Comments
BradleyUffner@lemmy.world 9 months ago
stebo02@sopuli.xyz 9 months ago
it would still be confusing why all semicolons are highlighted
qaz@lemmy.world 9 months ago
VSCode has a special case for this
etler@programming.dev 9 months ago
That means that detection was added explicitly because this prank was done enough that it was worth it to add.
dylanTheDeveloper@lemmy.world 9 months ago
We do a little trolling
Quik@infosec.pub 9 months ago
The reason is in fact not only because of this exact symbol, but because people tried to change program’s behavior in a malicious way by replacing legitimate code with same looking symbols.
NegativeLookBehind@kbin.social 9 months ago
Something similar happened to me a while back. I was copying some code from a Mac to a remote Linux host. For some reason the Mac was using a thing called an “en dash”
–
which is slightly longer than a regular hyphen-
and was really fucking frustrating to figure out.pthaloblue@sh.itjust.works 9 months ago
I don’t know why I’m here commenting about this, but I love type, so:
Hyphen (-): the short one, used for hyphenated words. fire-eaters. Close-up.
en-dash (–): slightly longer, traditionally the length of a lowercase"n" in the typeface. Used between for things like a timeframe. 10–11:30, August–October
em-dash (—): the longest of the three, and the length of a lowercase “m”. Used as a punctuation mark to denote a side comment or to abruptly cut off a sentence. “It’s a great punctuation mark—in fact I overuse it—but it’s still useful.” “Hey where are you going with that giant—”
I didn’t bother to double check the definitions, so there might be more specific rules, but these are my rules of thumb.
Spiralvortexisalie@lemmy.world 9 months ago
Dictionary source for possible particulars: merriam-webster.com/…/em-dash-en-dash-how-to-use
Chemical@lemmy.world 9 months ago
Thank you. I have learned something new today!
lobut@lemmy.ca 9 months ago
Some mac apps have some quirks, the default note app was probably not meant for pasting code in, but when you do it changes the quotes and makes them all fancy. Drives me up the wall and there’s nobody to blame but me.
jadedwench@lemmy.world 9 months ago
I was looking for this. Some text from webpages end up pasting that way too, even on non-mac systems, and it is utterly infuriating. Nothing I hate more than having to paste something into notepad++ so I can fix all the stupid quotes from some online tutorial that is giving you things to paste into a command prompt.
python@programming.dev 9 months ago
ESLint has entered the room
MeatsOfRage@lemmynsfw.com 9 months ago
Or any coding software really. Does this guys friend code in notepad?
newIdentity@sh.itjust.works 9 months ago
Who uses semicolons in Javascript?
seitanic@lemmy.sdf.org 9 months ago
Programmers who care about best practices. Here are a couple of scenarios where not using a semicolon will bite you in the ass.
tkarika@lemmy.world 9 months ago
Every real programmers
psud@aussie.zone 9 months ago
In that sentence, we use “programmer” singular, because “every” is singular, though referring to many
All real programmers
Every real programmer
Each real programmer
No real programmer
It’s pretty arbitrary
Perfide@reddthat.com 9 months ago
People who like minimizing the amount of bug fixing.
BearJCC@lemmy.sdf.org 9 months ago
Old habits die hard. Learned JS, CSS and C++ all the same year about a decade ago.
manapropos@lemmy.basedcount.com 9 months ago
I use prettier which by default adds semicolons. Coming from predominately doing backend stuff (mostly in Java) I don’t really mind, especially when the formatter adds them for me
newIdentity@sh.itjust.works 9 months ago
That’s what I do too, but i don’t manually add them
coffee_poops@sh.itjust.works 9 months ago
semicolons are optional in js anyway…
mrpants@midwest.social 9 months ago
Most of the time. Sometimes it can lead to code that is ambiguous and ASI picks the wrong way to interpret it.
coffee_poops@sh.itjust.works 9 months ago
Right, but there’s not going to be a syntax error.
drew_belloc@programming.dev 9 months ago
If the language doesn’t force me to use semicolons i will forget
itsraining@lemmy.world 9 months ago
I don’t think any Greek layout uses a different Unicode codepoint for the question mark. In fact, the classic semicolon is used, so what the meme describes would not happen IRL.
Does all this make it any less funnier? No. It’s brilliant.
luciferofastora@lemmy.zip 9 months ago
In Unicode, it is separately encoded as U+037E ; GREEK QUESTION MARK, but the similarity is so great that the code point is normalised to U+003B ; SEMICOLON, making the marks identical in practice.
Source: en.wikipedia.org/wiki/Question_mark
I’m still curious whether it would be accepted by the code interpreters / compilers of various languages. I’m not bold enough to assume they all normalise properly.
itsraining@lemmy.world 9 months ago
Wow, thank you, didn’t know of that.
nxfsi@lemmy.world 9 months ago
Unicode should have enforced the principle of using the same encoding for similar looking characters like they did with CJK instead of allowing bullshit like the Cyrillic “o” or the Greek question mark.
yum13241@lemm.ee 9 months ago
1,000% percent.
Boxman@lemmy.world 9 months ago
Me who programs in rust with a specific compiler message to tell me what happened
Hawk@lemmy.dbzer0.com 9 months ago
Cargo fix
tfw_no_toiletpaper@feddit.de 9 months ago
I don’t even know what to say to this one.
darcy@sh.itjust.works 9 months ago
any modern compiler or ide will notice this and warn you.
massive_bereavement@kbin.social 9 months ago
Same, I thought this is gotta be a problem for someone who uses notepad as their main editor.
Jumuta@sh.itjust.works 9 months ago
meanwhile vim:
darcy@sh.itjust.works 9 months ago
vim is not an ide i believe. but an lsp will notice
watcher@nopeeking.link 9 months ago
Yeah, it will tell you that it existed a semicolon… 😁
luciferofastora@lemmy.zip 9 months ago
…for which my default fix would be to delete and reenter it in hopes of fixing ehatever hiccup the syntax validator is having