3 ms·
Hah! This fits with the point of the article I guess. I mean, I started with Pascal, then C and C++, then PHP, then Ruby then C# and some Java, then Scala, the
by skrebbel 8y ago
Hah! This fits with the point of the article I guess.
I mean, I started with Pascal, then C and C++, then PHP, then Ruby then C# and some Java, then Scala, then JavaScript, and now Elixir and TypeScript. Of all those, I like TypeScript the best (barring the NPM / deployment / transpilation / packaging mess, that is). I mean, I like it the best by far. It combines functional with OO much like Scala set out to do, but in a much simpler and more accessible way. I really love it, I think in its structures. All JS I write feels like TypeScript. Even a lot of the Elixir I write (for better or worse) feels like TypeScript with a funny syntax.
I now feel like structural typing is the big missed opportunity of most statically typed languages. The fact that I can define a type simply by writing, say, an object literal, continues to make my day.
let a = { name: "Pete", age: 6 };
a.nmae = 7; // type error!
a = { nmae: "Mike", age: 7 }; // type error!
or even
function moo() {
return { name: "Pete", age: 6 };
}
const a = moo();
a.+---------------------+
|name string |
|age number |
+---------------------+
Stuff like this feels so normal so quickly that I feel like I'm using yesterday's tools whenever I either don't get the autocomplete/type error (hi Elixir, Ruby, Python, PHP), or I have to manually add a `type Moo = yada yada` declaration above my function (hi Haskell, Scala, C#, F#, Java, srsly all of them).
I'm not claiming any of this is new. I mean truth is I haven't seen any Haskell or F# or Scala code that does this, but I bet that's just my limited exposure to functional languages. I've heard these languages are pretty powerful, so sorry if I insulted your cult there :-)
Still, I've used no other language that enables this ability to write code the way one would write dynamically typed code - head-first, straight down into the operational stuff, and finetune the data structures as we go along - while still getting type checking and all the confidence and tool support that comes with it for free.
I agree with the OP. TypeScript is my cult. <3
- insulanian 8y agoNext version of F# is bringing anonymous records, which can give similar experience to your structural typing examples.