[mercury-users] Meta programming in Mercury
David Glen JEFFERY
dgj at cs.mu.OZ.AU
Wed May 19 14:43:10 AEST 1999
On 19-May-1999, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 18-May-1999, Luke Evans <Luke.Evans at seagatesoftware.com> wrote:
> > Is there any way to submit new code to the Mercury compiler at runtime?
>
> Yes, you can write the code out to a file and then use
> io__invoke_system to invoke `mmc' to compile it. You can then
> dynamically link the compiled code into your executable using the
> dynamic linking support in extras/dynamic_linking/dl.m (in the latest
> development versions of the Mercury distribution).
Mind you, this is not a particularly elegant approach to meta-programming.
Perhaps one day we will provide something nicer. (No, I'm not suggesting
anything in particular... yet. ;-) ).
You could write an interpreter by hand (interpreting something like the
`term' type). See samples/interpreter.m in the Mercury distribution for
an example. As you point out, though, this is not really all that much better
than what you might do in an imperitive language.
I guess this is (yet another) one of those things for the next library
version...
dgj
--
David Jeffery (dgj at cs.mu.oz.au) | Marge: Homer, is this how you pictured
PhD student, | married life?
Dept. of Comp. Sci. & Soft. Eng.| Homer: Yup, pretty much... except we
The University of Melbourne | drove around in a van solving
Australia | mysteries.
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list