[mercury-users] Meta programming in Mercury

Luke Evans Luke.Evans at seagatesoftware.com
Wed May 19 20:10:15 AEST 1999


Thanks for the tip.  Yeah, I thought about doing the compile/link thing for
a couple of microseconds before the 'heavyweight' nature of this approach
put me right off.  Given my background (mainly imperative languages, with
some Prolog thrown in for good measure), I've little experience with
functional approaches and HO in particular, so I'm going to have to play
around with this to see how it can be put to this use.

Luke



-----Original Message-----
From: Ralph Becket [mailto:rwab1 at cam.sri.com]
Sent: Wednesday, May 19, 1999 10:04 AM
To: mercury-users at cs.mu.OZ.AU
Subject: Re: [mercury-users] Meta programming in Mercury


Luke Evans wrote on 18 May:
> Is there any way to submit new code to the Mercury compiler at runtime?
I'm
> guessing that the answer is no, given that there's currently no
interpreter
> to handle any bytecode this process might generate.  If this is the case,
> are there any plans which would permit meta-programming in the future, or
is
> the whole concept considered anathema! 
> 
> I'm not sure if I even need this yet, but a new project will probably
> involve describing fuzzy relationships which are discovered at runtime.
> Obviously I could describe these in my own high level representation (as
one
> would have to do in an imperative language), but in Prolog I would have
the
> option of representing the logic as a part of the program itself.

What you're doing here is introducing new names to the namespace at
runtime which, as Fergus has pointed out, you can do using the
relatively heavyweight method of bailing out to the Mercury compiler.

Have you considered using higher order functions instead?  While the
compiler may not be able to optimise them as well as first order code,
you don't have to pay the hit of stopping to run the compiler before
you can use the results.  And HO code really doesn't cost that much.

Cheers,

Ralph

-- 
Ralph Becket  |  rwab1 at cam.sri.com  |
http://www.cam.sri.com/people/becket.html
--------------------------------------------------------------------------
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
--------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 3532 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/users/attachments/19990519/8941f7b7/attachment.bin>


More information about the users mailing list