You are viewing a single thread.
View all comments View context
51 points

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.

permalink
report
parent
reply
14 points

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

permalink
report
parent
reply
4 points
*

a sane language

JavaScript

Pick one.

permalink
report
parent
reply
1 point
*

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

permalink
report
parent
reply
1 point

What’s a sane, dynamically typed language?

permalink
report
parent
reply
3 points

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.

permalink
report
parent
reply
1 point

Lisp?

permalink
report
parent
reply
1 point

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

permalink
report
parent
reply

Programmer Humor

!programmer_humor@programming.dev

Create post

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

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics

Community stats

  • 2K

    Monthly active users

  • 861

    Posts

  • 14K

    Comments