News for hackers. Stuff that matters.
Re:Announcing TypeScript 2.0 by wvenable on Thursday September 22, 2016 @05:01PM (#12560343)
Type inference makes all the difference in my opinion. Once you have even simple (C# level) type inference than the overhead of static typing is so low there isn't much reason to use dynamic typing.
Re:Announcing TypeScript 2.0 by jeremiep on Friday September 23, 2016 @10:22AM (#12564815)
Yes I agree type inference is wonderful! But when the underlying type-system is just C# I feel like I'm given a half-assed solution.

What good is having a int type if you can't limit its range?

I'm not going to maintain BOTH static types and tests. The ROI is way too low on that and won't even come close to guarantee robustness.

Assertions over composable predicates gives me much more out of the time invested to write it. They are right there in the code at runtime, not separate like unit tests or in a different phase like static types.

Re:Announcing TypeScript 2.0 by wvenable on Friday September 23, 2016 @11:23AM (#12565277)
> What good is having a int type if you can't limit its range?

Well then you don't have to test what happens when someone passes a string, an object, or a boolean. Most dynamic languages will silently convert many of these values into an int and produce incorrect results.

> I'm not going to maintain BOTH static types and tests.

You have to maintain documentation and you have to maintain tests and you have to maintain assertions for the implied types of your functions anyway so you might as well make them explicit in the code.

Re:Announcing TypeScript 2.0 by jeremiep on Friday September 23, 2016 @12:06PM (#12565610)
> Well then you don't have to test what happens when someone passes a string, an object, or a boolean.

That's useless, I still need to test the value's range which implicitly checks the type.

> You have to maintain documentation and you have to maintain tests and you have to maintain assertions

Not if I can generate most of it from the specification data.

Re:Announcing TypeScript 2.0 by wvenable on Monday September 26, 2016 @06:53PM (#12586311)
> What good is having a int type if you can't limit its range?

Most types in the program aren't ints anyway; they're interfaces. If I want to have a range-limited value, I could just create a new type for it.