@adkron Optional type systems like TypeScript would allow you to type individual methods, even variables, at your own granularity. My only reservation is their module system which has some unique implementation details (type definitions in
@thegecko I haven't checked atScript, but I'm a bit familiar with TypeScript. Right now, Tessel's runtime has LuaJIT's optimized interpreter but not its JIT enabled. This offers a smaller range of possibilities for optimization, so the most important become:
- Having predictable types (number on number arithmetic, no implicit casting, etc.) Basically anything whether the interpreter doesn't have to jump to a "special case" for an operation. TypeScript doesn't enforce this but being type-aware in your code helps this.
- Forcing integer logic. If TypeScript special cases integer arithmetic (even forcing (5 / 4) to be an integer by compiling to ((5 / 4) | 0) this would be a great boon since integer logic is way cheaper than floating point logic in the interpreter.
- Fewer function method overloads. Accessing known properties of objects and predefining their values, as you would in TypeScript classes, is much faster than traversing the prototype tree looking for an uninitialized property values.
My conclusion would be using TypeScript as a preprocessor has benefit, and would have a large benefit in a JIT environment, but there's no need to recycle extract that type information in a special way for it to be of use. The enforcement that you're writing statically-typed code is enough.