this post was submitted on 23 Jun 2024
735 points (96.5% liked)

Programmer Humor

19587 readers
1030 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
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 138 points 4 months ago (2 children)

On the other hand, I don't think you should add those ever

[–] firelizzard 52 points 4 months ago (3 children)

Sure. But in a sane language doing something totally nonsensical like that is an error, and in a statically typed language it’s a compiler error. It doesn’t just silently do weird shit.

[–] [email protected] 14 points 4 months ago

Agreed! Unfortunately these maddening behaviors were kind of set in stone several decades ago, and it has been (correctly) decided "Don't break the web", these weird quirks are kept in modern interpreters/compilers.

It's actually quite interesting to read through the logic to follow when implementing an interpreter:

https://262.ecma-international.org/13.0/#sec-object.prototype.tostring

[–] [email protected] 4 points 4 months ago* (last edited 4 months ago) (1 children)

a sane language

JavaScript

Pick one.

[–] firelizzard 1 points 4 months ago* (last edited 4 months ago)

I thought it was clear I was saying JavaScript is not a sane language for this very reason

[–] [email protected] 1 points 4 months ago (3 children)

What's a sane, dynamically typed language?

[–] firelizzard 3 points 4 months ago

I was trying to make a point without starting a flamewar that was beside the point. Personally I’d never choose a dynamically typed language for a production system. That being said, Python and Ruby complain if you try to add an array, dict/hashmap, string, or number to another (of a different type) so they’re certainly more sane than JavaScript.

[–] [email protected] 1 points 4 months ago

Any of them which are still strongly typed. Just because a language doesn't check for type errors before runtime doesn't mean it won't check at all

[–] [email protected] 1 points 4 months ago
[–] [email protected] 46 points 4 months ago (1 children)

Onfuscators probably use it though, so no spec ever will be able to get rid of this crap.

[–] [email protected] 16 points 4 months ago (2 children)

Can I vote for obsfuscators not holding a language hostage?

[–] msage 7 points 4 months ago

Best I can do is tie your pension to it.

[–] [email protected] 2 points 4 months ago

Only if I can vote for sandwiches not falling apart when I eat them