Alpha updated

Brian Rice water at tunes.org
Thu Apr 21 17:27:40 PDT 2005


There's nothing critical this week, just new features and bug-fixes, 
all on the image side (alpha is updated as usual):

I've been working on Slate code auto-loading. What this amounts to is 
parsing a file and processing it for its definitions, then creating 
methods that stand for those definitions in the image which 
/transparently/ load the file. So if Trie were not loaded, I can now 
run:

((File newNamed: 'src/lib/tree.slate') as: Module) installAutoloaders.

and "prototypes collections Trie" (along with other prototypes and 
namespaces created in tree.slate) will be defined as such:

_@(prototypes collections) Trie [... load the module and return the 
Trie prototype...]

So, merely mentioning Trie will cause loading of the file and obtaining 
of the object it should represent. Since Slate namespace/type 
definitions rely on making accessor methods so that you can refer to 
them, this "Trie" method will be replaced by an accessor for the real 
object. Any other methods pretending to be accessors that correspond to 
what the file defines will also be replaced.

There are caveats:

1) If one object is defined in one file that's not loaded, and a second 
on /top/ of that object (e.g. installed on the object's traits objects 
like what we have been doing with type-specific conditions or streams), 
then the dependency between them will be ignored. So until I fix this 
with a mini-database for such dependencies, this will only work for 
first-level loads. Examples that come to mind are the FFI libraries 
types/c.slate and extlib.slate, although I have not done any testing of 
this yet.
2) You have to parse all the files you want to be autoloadable in the 
same image where they'll be loaded later. So, it takes quite some time 
and I might have that be done for the initial library bootstrap or 
something so it's an implicit build step instead of something 
interrupting work-flow.

I've discussed this with a few people already, and preliminary tests 
work pretty well.

...other new features:

String plural (makes a plural using the most common english rules, 
although of course it'll go wrong in general).
Integer inverseMod: on request for someone doing numerical analysis.
Method signature and roleHolders to get a Method signature and the 
array of objects with roles to the exact method. Symbol 
findSignatureOn: and findRoleHoldersOn: corresponding to the above but 
doing a method search. Both of these take an &in: namespace parameter.

--
Brian T. Rice
LOGOS Research and Development
http://tunes.org/~water/




More information about the Slate mailing list