bobjervis / parasol

The Parasol Language and related core development tools
Apache License 2.0
2 stars 2 forks source link

Refactor root.p #11

Open bobjervis opened 9 years ago

bobjervis commented 9 years ago

Currently, root.p encloses a bunch of code in the base classes, most notably in string. Also, root.p does not support imports. The compiler should allow imports and root.p should be refactored so that the implementation code for things like printf can be moved to dedicated files. The same for vector, numeric classes, etc.

This envisions root.p as a small coordinator of definitions stored elsewhere.

Note that this blocks floating point printf because %e, %f and %g depend on C routines ecvt, fcvt and gcvt respectively.

bobjervis commented 9 years ago

I've managed to move 17 class definitions out of root.p and into various namespaces around the runtime library. I've also removed a few unused classes and moved a couple of utility methods (like memDump) off because they aren't really needed in EVERY bloody namespace.

Template classes can't be migrated yet, because you can't import parameterized names, nor can you import an 'overload' name and have it resolve well. There's also a handful of built-in functions (like memset, memcpy and print) that should be moved out, but require some compiler changes to make those feasible. Leaving this ticket open for now.