this post was submitted on 09 May 2024
445 points (92.2% liked)

Programmer Humor

32558 readers
375 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] dejected_warp_core@lemmy.world 27 points 6 months ago (4 children)

One nit: whatever IDE is displaying single-character surrogates for == and != needs to stop. In a world where one could literally type those Unicode symbols in, and break a build, I think everyone is better off seeing the actual syntax.

[–] PlexSheep@infosec.pub 21 points 6 months ago (1 children)

I think it's a lineature. FiraCide does that for example, and I like it very much. My compiler and lsp will tell me if there is a bad char there. Besides, the linea tires take the same space as two regular characters, so you can tell the difference.

It's not the 90s anymore. My editor can look nice.

[–] darkpanda@lemmy.ca 3 points 6 months ago (1 children)
[–] PlexSheep@infosec.pub 1 points 6 months ago

Oops, good to know.

[–] savedbythezsh@sh.itjust.works 8 points 6 months ago

In a world where your IDE and maybe also compiler should warn you about using unicode literals in source code, that's not much of a concern.

VSCode (and I'm sure other modern IDEs, but haven't tested) will call out if you're using a Unicode char that could be confused with a source code symbol (e.g. i and ℹ️, which renders in some fonts as a styled lowercase i without color). I'm sure it does the same on the long equals sign.

Any compiler will complain (usually these days with a decent error message) if someone somehow accidentally inserts an invalid Unicode character instead of typing ==.

[–] Oinks@lemmy.blahaj.zone 7 points 6 months ago

If your build fails because you can't track down the literal in the code I would recommend just looking at the compiler error. I understand the concerns about == vs = more but the vast majority of LSPs (and some compilers) will catch that too.

I have also yet to see any IDE enable ligatures by default, at least VS Code and the JetBrains suite both require opting into them even though their default fonts support them.

[–] JK_Flip_Flop@lemmy.world 6 points 6 months ago (1 children)

I love ligatures but much prefer the ones that preserve the proper width of all the characters for this exact reason

[–] baod_rate@programming.dev 5 points 6 months ago

are there ligatures for monospace fonts that don't preserve the width of the characters?