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

As a hardcore fan of static typing, how would you convince me to use a gradual typing model?


Gradual typing gives you the option. You can be as statically typed as you want. Dart is gradually typed. So when I'm writing some flutter code, I may not know when types I need in the moment, I can omit type signatures until I work that out then write my types and go back to update the code.


I wouldn’t. My experience with Flow and Typescript is that the incremental adoption bit is misleading. It’s a hook. It’s possible, but you’ll quickly come to resent your JS code and go all in. That process will get you through most of the learning curve and that’ll be that.


How do you type something like the groupBy function in TS?


Which language do you work in? I can promise you that Typescript can type things way more strictly than your language, unless it's Julia.

Typescript allows you to not make typing very strict when it's not important, but also allows you to define things stricter than your average Haskell codebase.

Most other languages have only 1 option about how strict a piece of code is typed.


My situation is: I statically know the types of things at compile time. I'm not sure how to 'define things stricter than that'.

My question was: what benefits would I get from sometimes not knowing the types at compile time (which is what I guess gradual typing is)?




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

Search: