exportFn and evalStream questions
Joe Wells <[email protected]> Mon, 05 Oct 2009 13:43:18 +0100
| Newsgroups | gmane.comp.lang.sml.smlnj |
|---|---|
| Message-ID | <[email protected]> |
Dear SML/NJ gurus, Would it be possible for someone to please answer 1 or more of the following questions about exportFn and evalStream? 1. Where does exportFn discard the contents of the top-level environment? I've been looking through the source code and if I have seen it I certainly have not recognized it. It is clear that this is happening both from the documentation and also from the fact that subsequent uses of evalStream or useStream seem to complain that all identifiers are undefined. 2. Is it possible to get the same space-saving effect as exportFn without having to write a heap image to disk and then exec a fresh sml process to load the heap image? (Another problem this would avoid is the fact that exportFn closes all files and clears the signal handler table.) Is it enough to clear the top-level environment by hand and then let the garbage collector do its work? And does anyone have any example SML code that clears the top-level environment correctly? Can doing this release memory back to the system? If not, can doing this at least reduce the amount of work the garbage collector needs to do regularly? 3. Is is possible to preserve some portion of the top-level environment across an exportFn? It would be enough to preserve the constructors and type names of some datatypes and built-in types, so that evalStream and useStream could still work for parsing, type checking, and pretty printing datatype values. 4. Can someone provide an example of constructing a custom environment for use with evalStream? Any example would do. I already know how to do something that seems equivalent to the top-level environment. It would be particularly nice if the example showed how to include just datatype constructors and type names. Thanks for your time in considering my questions. And extra thanks if anyone answers even just one of my questions! -- Joe -- Heriot-Watt University is a Scottish charity registered under charity number SC000278. ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf