Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The debate seems to have mostly ended in a victory for static types.

The largest languages other than Python have them (if you include the transition from JS to TS). Python is slowly moving toward having them too.



I honestly don't see how anyone who has used a language with both unions and interfaces could come up with anything else that makes dynamic types better.

Either way you need to fulfill the contract, but I'd much prefer to find out I failed to do that at compile time.


Don't confuse "presence of dynamic types" with "absence of static types."

Think about the web, which is full of dynamicism: install this polyfill if needed, call this function if it exists, all sorts of progressive enhancement. Dynamic types are what make those possible.


Sure, I'm primarily a C# programmer which does have a dynamic type object, and occasionally use VB which uses late binding and can use dynamic typing as well.

You want to know how often I find dynamic typing the correct tool for the job? It's literally never.

Dynamic typing does allow you to do things faster as long as you can keep the whole type system in your head, which is why JavaScript was designed the way it was. That doesn't mean it is necessary to do any of those things, or is even the best way to do it.


the place where imo static languages come up short is first class functions.


I think C# has first class functions. Any pure function you can pass around. And you can create lambdas.

gcc has nested functions that can act like a closure.

And Clang has blocks.


What are you talking about, the majority of functional languages have static types.


The whole anytype/trait question is just dynamic typing, but at the type level instead of the value level.


If I'm told to still use === in typescript, it's not actually a statically typed language.


It's not a statically typed language. No one is claiming it is. It's a dynamic language with static types.


Nonsense.

If I need to keep using === because the type might actually be something different at runtime, it doesn't have static types.


It has static types because the compiler won't let you change a variable's type.

It's exactly as statically typed as C#. Both allow explicitly-declared dynamic variables, but they're disabled by default.

=== is incidental syntax required to maintain the goal of being a superset of JS.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: