LokiChaos / Materiamagica-on-tintin

A collection of tintin++ scripts for playing MateriaMagica
8 stars 1 forks source link

Standard Library #17

Open LokiChaos opened 8 years ago

LokiChaos commented 8 years ago

I am working on a major re-work of lib, focusing on the "standard library" of functions (as opposed to the Class, Loader, or module systems). A lot of this is to isolate some tintin-isms in more meaningful/descriptive wrappers and provide built-in sanity checks.

I have written a typing system and an argument checking function that will allow functions (and aliases) to check that they got the right number and type of arguments. Since tintin++ lacks a proper type system I had to implement my own based on how tintin++ can treat different values.

Finally I am fixing the names of functions, adding sets, msets, and priority queue types.

Once this is finished, the vast majority of core and modules can likely be converted to more extensively use lib and code should be more expressive and a get a lot of "free" debugging from the argument checking.

LokiChaos commented 8 years ago

This is coming along well. The argument checker is working, but I want to optimize it.

Additionally I have implemented a lexical (private/My) and dynamic (Local) scoping system emulating Perl's. It is working, but something so often called needs be heavily optimized. Currently the lower bound on entering/exiting scope is 295µs (ie: just entering and immediately exiting a scope with no variable creation). Which is acceptable, but I think I can get it under 200µs.

LokiChaos commented 8 years ago

I have added the variable scope system to ttext.tt and am beginning to test it and integrate it into lib/ in some places. Argument checker is being optimized and cleaned up before library functions will be adapted to use it. I have started work on generic set, multi-set/bag, and pqueue implementations.

LokiChaos commented 8 years ago

Latest tintin++ beta has a #LOCAL command, doing some testing, but I will use it over my custom scope system as it should be far faster.