News for hackers. Stuff that matters.
Re:TypeScript 3.6 by benatkin on Wednesday August 28, 2019 @05:42PM (#20824295)
It changes the order in which I think about solving problems, to something I'm less comfortable with.
Re:TypeScript 3.6 by ajxs on Wednesday August 28, 2019 @06:08PM (#20824542)
Is that really true though? To me this sounds more like making the validation of the program an afterthought, at best. Even in very academic mathematical models, introducing types early usually doesn't introduce much of a cognitive burden. I maintain that even when developers don't think that they're reasoning in terms of types, in many cases they are: "This is function 'x'. It takes two items of type 'T', which have to have a member 'a', which is a number. Function 'x' multiples the two 't.a' values together and returns a new 'T' with the result in its 'a' field."

If you opted to forego static typing, every step of the above function would require you to validate that you're dealing with the types you think you are. This kind of example isn't even at all uncommon.

Re:TypeScript 3.6 by rq1 on Wednesday August 28, 2019 @06:04PM (#20824510)
Isn’t it preferable to start with data modeling?

You can disagree but:

> Rule of Representation: Fold knowledge into data, so program logic can be stupid and robust.

http://www.faqs.org/docs/artu/ch01s06.html#id2878263

Statically and strongly typed languages excel exactly at this.

Re:TypeScript 3.6 by Koshkin on Wednesday August 28, 2019 @05:59PM (#20824470)
That's understandable - being pestered with error messages early on is not to everyone's taste and can indeed interfere with one's creative process. But can't one always start with JS and switch to TS later?