Thank you for publishing this comparison. I must say: I use union types all of time, so that’s unfortunate. But the mental shift from using === to == will be a strong barrier to entry for most JS devs. I think your example of the string equality perfectly summarized why it’s very unintuitive for JS devs who spent years understanding type coercion. I wonder why the language creators of AssemblyScript decided to go that route. I mean I understand not supporting unions since that’s probably rather complicated, but changing the way type coercion works... that’s a tough change to accept.
This little feature is actually one of the reasons why I love the language. It wasn't hard for me to get used to at all, and I've spent my whole life in JavaScript.
First of all, since you can guaruntee type correctness at compile time, the === operator becomes pointless anyway. You probably won't compare an i32 with a Vec3 ever, thus, all the benefits of using this strict equality operator are gone.
Not every feature in the Javascript specification can be ported because the nature of Web Assembly makes things complicated. Also, being able to program your own equality comparison using the @operator("==") syntax makes it all worth it.
Just like everything else in life, some things take time and practice.
Thank you for publishing this comparison. I must say: I use union types all of time, so that’s unfortunate. But the mental shift from using === to == will be a strong barrier to entry for most JS devs. I think your example of the string equality perfectly summarized why it’s very unintuitive for JS devs who spent years understanding type coercion. I wonder why the language creators of AssemblyScript decided to go that route. I mean I understand not supporting unions since that’s probably rather complicated, but changing the way type coercion works... that’s a tough change to accept.
This little feature is actually one of the reasons why I love the language. It wasn't hard for me to get used to at all, and I've spent my whole life in JavaScript.
First of all, since you can guaruntee type correctness at compile time, the
===
operator becomes pointless anyway. You probably won't compare ani32
with aVec3
ever, thus, all the benefits of using this strict equality operator are gone.Not every feature in the Javascript specification can be ported because the nature of Web Assembly makes things complicated. Also, being able to program your own equality comparison using the
@operator("==")
syntax makes it all worth it.Just like everything else in life, some things take time and practice.
Yup, software design is all about tradeoffs.