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

>Does optional typing really work?

From my experience with Dart, I'd say it can work really well. Basically, if you just put type annotations at the API boundaries, you already get most of the type related benefits you would get with something like Java or C#.

Inside your functions, you can generally omit types. For the tools, there is enough type information floating around to make sense of everything.

If you use a literal, the type is known. If you use some annotated function, the type of the return value will be known. If you assign any of these things to "var", the actual type will be remembered. This means you get sanity checks, call-tips, and auto-complete without having to annotate the types there.

Putting types at the API boundaries also acts as documentation. It's so much better than writing JSDoc comments. Plus, you get all the benefits right away. It's a very sweet deal.



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

Search: