by yread · 7y ago · 0 comments
Well, to his defense, TypeScript is indeed a variant of JS.
I think a better example would be Typed Racket.
C++ did none of that.
Unlike ObjC, there was no heavy runtime in initial versions. It was physically impossible, because it compiled into C. Even in modern versions, C++ runtime is very small unless you use corresponding standard library features.
Similar for language features. Before templates, C++ only added a few keywords to the language. In the same manner TS adds strong typing, interfaces, generics and modules.
So I guess it depends on your usage of variant, does that include strict supersets?
In my rulebook, the answer’s no. When you say “X is a variant of Y” I assume it means Liskov substitution principle must be true for them.
You can’t compile C++ with C compiler, therefore C++ is not a variant of C.