Re: "eval"?
Geoffrey Alan Washburn <[email protected]>
| Newsgroups | gmane.comp.lang.sml.smlnj |
|---|---|
| Message-ID | <[email protected]> |
Matthias Blume wrote: > The easiest way is to use Backend.Interact.useStream. (Just open > Backend.Interact to see the signature.) The trick is to arrange > for some ref-cell of known type to be in scope (bound at the interactive > toplevel), and have the code that you send to useStream set that > ref cell. This way you can later get access to the value. > > A bit more tricky is using Backend.Interact.evalStream, since you > have to provide an explicit environment. You will have to > make use of structure EnvRef to get access to the various environments > that the toplevel loop manipulates. (Just say open EnvRef.) > See sml/base/compiler/TopLevel/interact/* for more info on what's > going on. (This is in 110.60.) > > Hope this helps... I just tried looking at Backend.Interact.useStream briefly and it looks like it does what I'd like. There seems to be a little bit of trickiness with regards to scoping between the top-level loop and what it evaluates, but my expectation is that the program will only ever communicate with the evaluated code in terms of string values. Thanks! ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV