UCC module changes
(1 post) (1 voice)-
I've been thinking of reworking the way that inclusions are handled, and files are handled by the interpreter. Right now they all get kind of cobbled all together, and this works fine for procedural applications, and for smaller apps, but for larger more object-oriented applications (Read: TFL) a module approach would be more helpful.
Here's an example of what I'm thinking of:
# File: example.ucc requires builtin imports foo, bar from example2This would create a module for example.ucc named "example".
This module needs another module to run, and thus defines it with the requires keyword.
It also imports two functions from example2, foo and bar.
The main problem for this in the current setup is what directories are looked for in the needs and includes.
Also, how to deal with the builtin functions is another thing.
I think for builtins, I will have the module builtin as alludded to above, and it will contain the original functions with their original names. Then all old scripts would need to do is include a "needs builtin" line to their files for things to work right, until I include the below :)
I will also have an "interpreter" module builtin to the interpreter to allow for some configuration options. This will include the following I think:
- interpreter.include_paths - Which would be a list of paths to look for files with "includes"
- interpreter.sys_path - Same as above but for "required", should point at whereever the ucc compiler is.
- interpreter.builtin_default - Boolean true if the interpreter includes the builtin module as a requirement of modules by default. For backwards compatability.
Eventually, I will probably re-implement all of the builtin functions as separate modules, and make UCC a "purer"programming language rather than a scripting language.
I was thinking of these for such library modules: random, stats, eggs, actors, scripts, weapons, monsters, time, date, time_of_day, schedules, converse
It's an ambitious project and I don't think it will be done soon, considering I do need to focus on TFL primarialy, but I would enjoy having a little more purer and easier to use UCC.
Cheers,
Peter M Dodge
aka Wizardry DragonPosted 8 months ago #
Reply
You must log in to post.
