Generics and Fns were a fun experiment but they have several problems:
generics have runtime cost even when checking is disabled. This is because even if MyGen{I='number'} immediately returns MyGen.any or something it still requires allocating the {I=...} part.
function generics have the issue that specialized versions cannot be stored in FNS. This required all sorts of mental math to use Method etc... no, just no. Functions cannot be checked at runtime period.
Interfaces, parent classes, etc are all too complicated for their own good. Interfaces require several lookups to type check (and without function types what are you even accomplishing?).
non-generic functions are also a no-no. What is the type of function min(a, b) return (a > b) and b or a end? Using generics it would be <A>[A, A -> A] but if we cannot have generics or interfaces then it's pretty much useless.
These things are all good, but are the domain for a type-safe language like Teal. In a type-safe language all non-concrete types (generics/interfaces/obj-model/etc) would be converted to Any for the metaty record (type-erasure).
Metaty's primary purpose is to make expressing and checking simple types easy while leaving complicated types for other solutions. It enables clean debugging, serialization and runtime (unit-test time) type checking.
Generics and Fns were a fun experiment but they have several problems:
MyGen{I='number'}
immediately returnsMyGen.any
or something it still requires allocating the{I=...}
part.FNS
. This required all sorts of mental math to useMethod
etc... no, just no. Functions cannot be checked at runtime period.function min(a, b) return (a > b) and b or a end
? Using generics it would be<A>[A, A -> A]
but if we cannot have generics or interfaces then it's pretty much useless.These things are all good, but are the domain for a type-safe language like Teal. In a type-safe language all non-concrete types (generics/interfaces/obj-model/etc) would be converted to
Any
for the metaty record (type-erasure).Metaty's primary purpose is to make expressing and checking simple types easy while leaving complicated types for other solutions. It enables clean debugging, serialization and runtime (unit-test time) type checking.