alore icon indicating copy to clipboard operation
alore copied to clipboard

Support strict runtime type checking

Open JukkaL opened this issue 14 years ago • 0 comments

Currently the implementation ignores type annotations when running programs. This means that when assigning value of type "dynamic" to a statically-typed variable, there is no check that the type is correct. Implement an alternative mode where cases like these are checked.

There are basically two ways of doing this:

  • Only check the "ground" type. Do not add wrappers. For generic types, ignore the type arguments -- for example, if the target type is Array<Int>, only check that the instance is of type Array, but check the item types only when they are accessed and bound to a statically-typed variable.
  • Add wrappers that add type checks lazily, similar to gradual typing. This would allow type safety for generics (reified generics). The conceptual difference between the above is that now the object itself does the checking (the wrapper does it), not the client.

JukkaL avatar Oct 11 '11 10:10 JukkaL