Most active commenters

    ←back to thread

    160 points todsacerdoti | 14 comments | | HN request time: 0.959s | source | bottom
    1. Jean-Papoulos ◴[] No.41901260[source]
    This guy is not competent to talk about what he's talking about.

    >"JavaScript is, in my opinion, a working-class language. It’s very forgiving of types (this is one reason I’m not a huge TypeScript fan)."

    Being "forgiving of types" is not a good thing. There's a reason most "type-less" languages have added type hints and the like (Python, Typescript, etc) and it's because the job of a programming language is to make it easier for me to tell the CPU what to do. Not having types is detrimental to that.

    replies(9): >>41901279 #>>41901424 #>>41901541 #>>41901590 #>>41901822 #>>41901921 #>>41902028 #>>41902107 #>>41902656 #
    2. Doxin ◴[] No.41901279[source]
    > There's a reason most "type-less" languages have added type hints and the like (Python, Typescript, etc)

    I would like to clarify that even without typing python is a LOT less "forgiving of types" than javascript. It has none of the "One plus object is NaN" shenanigans you run into with javascript.

    replies(2): >>41901348 #>>41901491 #
    3. makapuf ◴[] No.41901348[source]
    Types are guidelines and strictly useful and a good thing. That said, one can wonder why languages like basic, python, scheme or php (dynamic, implicit types) have grown popular. Maybe for bad reasons but there IS an added value for implicit types. C++ (maybe even C !) has grown the auto keyword and other typed language have type inference. Which is not the same as "typeless" (it always is typed) but it defeats one of the "double check" security of types. And it's sometimes not needed (yes, if I initialize it with "abc" it may be a string)
    4. thefroh ◴[] No.41901424[source]
    while I'm a fan of TypeScript and using type hints in Python from an autocomplete and linting perspective, I am curious...

    ... has either language leveraged these to better tell the CPU what to do? presumably for perf.

    replies(2): >>41901441 #>>41901593 #
    5. yurishimo ◴[] No.41901441[source]
    PHP does but the types actually mean something. If your types can be stripped out to make the program run, I have a hard time believing that there is any optimization occurring there.
    6. tugberkk ◴[] No.41901491[source]
    sure. one is strongly typed and the other weakly typed.
    7. camgunz ◴[] No.41901541[source]
    There are plenty of good things written in languages with weaker type systems than TypeScript (Linux, your browser, HN). Using C/C++ or a dynamic language doesn't immediately make you incompetent.
    8. ◴[] No.41901590[source]
    9. iforgotmysocks ◴[] No.41901593[source]
    python ignores type hints
    10. graemep ◴[] No.41901822[source]
    Python is not "type-less" it is strongly typed. It will raise a TypeError if you do something like 1 + "1".
    11. gagaq ◴[] No.41901921[source]
    Please, preferring dynamic typing is not a sign of "incompetence". Stop this nonsense. Also, I won't question your competence because you called Python and JavaScript "type-less". The type-less languages (other than assembly) that were ever used were BCPL and B (predecessors of C).
    12. ◴[] No.41902028[source]
    13. wesselbindt ◴[] No.41902107[source]
    It's not forgiving of types at all. Reality is not forgiving of type errors. The only thing JavaScript does is move the moment where you find out reality is not forgiving of type errors to when your code is running in prod rather than at compile time, and makes them more implicit. That doesn't make it a bad thing per se to be forgiving of type errors. For example, if you really like fixing errors in production rather than before pushing them to production, this faux forgiveness is precisely what you should be looking for. It's all up to personal preference. Personally, I prefer knowing early on if there's problems with my code, and having a higher degree of certainty regarding it working or not.

    All of this is under the assumption that whatever you're writing has some degree of complexity to it (an assumption which is satisfied very quickly). Five line python glue scripts don't necessarily benefit from static typing.

    14. mkl ◴[] No.41902656[source]
    > the job of a programming language is to make it easier for me to tell the CPU what to do. Not having types is detrimental to that.

    JavaScript and Python have types, and Python has always been strongly typed (type hints have not changed that). Neither TypeScript or Python use type hints at runtime to help tell the CPU what to do.

    What type hints in these languages do is make it easier for you to describe more specifics of what your code does to your tooling, your future self, and other programmers.