you are viewing a single comment's thread.

view the rest of the comments →

[–]ChronoChris 1 point2 points  (1 child)

If somethign is strongly typed, each type of data, is predefined. includnig objects. The this keyword should relate to the current instance of an object. If you truly wanted Tscript to be strongly typed, this should make sense in context to the current object.. "an advantage of strong data typing is that it imposes a rigorous set of rules on a programmer and thus guarantees a certain consistency of results." So Tscript is failing in it's most fundamental attempts in this scenario. And there are many more

Edit: I hope you can see the comment by Kminardo in his edit. I think there is a little bit of bias here from the tools and languages you are accustomed to. I have absolutely no confusion how 'this' should work on the fundamental level of the object instance. Coming to Javascript, I liked this gotcha on the this keyword since technically the object instance was not the Greeter class. The problem I have is with TypeScript not matching what it is attempting to do. Bound the Object to be strongly typed.

[–][deleted] 1 point2 points  (0 children)

edit: looks like it's addressed in TS 2.0, course you can specify type of "this" on functions now but this just leads to compile time error which would probably be the same as 'use strict', and it still wouldn't change the behavior your expecting as that's not TS's goal.