"Priya Gopalan" <[EMAIL PROTECTED]> wrote:
The idea is: Use the environment as an accumulator, with Compiler.initialEnv as the starting point. And incorporate it into a new definition of "use".
This can be packed as a component and imported at the top-level.

Will this override the original implementation of "use"??

I don't quite understand. You mean you want to reimplement 'use'? Note that 'use' is only defined in the interactive toplevel. It does not make sense independent from it, as there is no environment it could affect. You have to use Compiler.evalWith - the way you did it in your example is perfectly valid and exactly how it is intended.

Or you use the component system instead, in the way you suggested per mail. That means instead of threading an "environment" you pass stuff via the component manager and respective imports.

[For other readers, here is the central idea to replace environment passing with imports:

1. Use Compiler.eval, which yields a package.
2. Manually enter that into the component manager using
ComponentManager.enter, under some URL of your choice (probably generated).
3. Import it from there where needed (either with import, or with
ComponentManager.link if the URL is not static).
]

Note that the source you pass to eval can also have imports, thus itself accessing the "environment". Of course, if the "environment" gets large then you end up with lots of imports, which might or might not make that approach infeasible.

It is hard for me to judge if this approach is workable for you. Isabelle's reliance on the 'use' function is likely to have imposed a program structure that is not particularly modular, at least not in the way Alice ML tries to support. So the component approach might at least require a lot of refactoring. But if done properly, I would hope it to work better than 'use' or any workarounds for that.

Also, in my experiment with
Making & importing the component was fine. But if I try to invoke "use" subsequently, i face the following error:
"Internal exception...while linking..."

"Internal exception" does not sound good, but I would have to see the code to understand what went wrong and if it is expected behaviour.

Hope this helps,
- Andreas


_______________________________________________
alice-users mailing list
[email protected]
http://www.ps.uni-sb.de/mailman/listinfo/alice-users

Reply via email to