On Nov 19, 2007 4:09 PM, Andreas Rossberg <[EMAIL PROTECTED]> wrote: > Vesa Karvonen wrote: > > FYI, I was able to work around Alice ML's special use semantics by > > using a queue and a stack of queues to simulate the use process. The > > UseLib has now been revised and works with Alice ML as well as > > Poly/ML, SML/NJ, and Moscow ML. > > Oh, cool!
A small and self-contained example of the use of UseLib (or just Use) library would be my SML translation of the "OO Shapes" example. See here: http://mlton.org/cgi-bin/viewsvn.cgi/mltonlib/trunk/org/mlton/vesak/tech/oo/imperative-shapes/ http://mlton.org/cgi-bin/viewsvn.cgi/mltonlib/trunk/org/mlton/vesak/tech/oo/framework/ My OO Shapes version compiles in SML (on all of the three SML compilers mentioned above as well as MLton and MLKit and possibly others I haven't tried) and in Alice ML. It encodes subtyping using parametric polymorphism (open products). > Not sure I understand what the "use process" is that you are referring > to, though. The idea is that with the Use lib you write .use -files for loading libraries (or programs or any program components) with the use -function that the Use lib redefines. In each .use -file, you must call the lib -function (UseLib.lib) precisely once and give it a list of paths to files to load. For practical reasons, paths in a .use -file are relative to the directory of the .use -file. So, when the call to the lib -function is ultimately evaluated, the lib -function must be able to find out the path to the .use -file that contained the call. That information isn't normally just directly available. The redefined use -function and the lib -function collaborate to maintain state that allows the lib -function to determine the file from which it was called. The queue and stack are used for that purpose and are used in such a way that the same code produces the correct result regardless of whether a use'd file is loaded immediately or put into a queue for loading after evaluating the current file. The manner (immediate or queued) in which use'd files are loaded is the "use process" I'm referring to. -Vesa Karvonen _______________________________________________ alice-users mailing list [email protected] http://www.ps.uni-sb.de/mailman/listinfo/alice-users
