14

Dev2: I don’t like the way that works

Dev: Me neither. But that’s javascript baby!

Comments
  • 1
    GarbageScript: Why javascript parseInt(0.0000005) prints out 5? https://stackoverflow.com/questions...
  • 3
    @fraktalisman

    That kind of garbage is present in any language without strict types though, or at least any language with implicit duck typing.

    Most language maintainers have realized by now that duck typing is stupid. Javascript, "because browsers", moves pretty slowly -- but you can get escape hell to some extent by using Typescript.
  • 2
    @bittersweet I have done weird shit like that in C++. I mixed up variables and tried to convert something to a string. C++ found an object to convert something to a strange character. It made sense when I found it, but there was a bit of wtf going on.
  • 2
    @Demolishun

    Yeah there are no strictly vs weakly typed languages. It's a spectrum.

    Those which used to be called "weak scripting languages" still have many leftover ducktyping oddities.

    Errors often result from concatenating where the dev tried to sum things, float handling, that sort of thing.

    But in Java or C++, you can still mess up if you accidentally dereference/pass null around, divide by zero, take the square root of a negative, etc.

    At the other extreme lives Haskell, where you define a type like "natural numbers" from scratch, to make sure your matrix multiplication functions are type-safe.

    https://softwareengineering.stackexchange.com/...

    Worth the effort? Possibly!

    Safety is overhead.

    So yeah, JavaScript is extremely garbage.

    But it's popular garbage, because it's easy and works 95% of the time, without all that meaty academical overhead of a perfect type system.
  • 3
    @bittersweet I identify as strongly typed
Add Comment