[mercury-users] Collections of closures

Warwick Harvey wharvey at cs.monash.edu.au
Mon Jan 10 12:57:35 AEDT 2000


Fergus wrote:
> On 07-Jan-2000, Ralph Becket <rbeck at microsoft.com> wrote:
> > :- func wrap(my_closure) = my_wrapped_closure.
> > :- mode wrap(my_closure_in) = out is det.
> > 
> > :- pragma c_code(wrap(X::my_closure_in) = Y::out,
> > 	will_not_call_mercury, "Y = X;").
> >
> > and vice versa for unwrapping closures.
> 
> For the `wrap' operation, you can use a no-op.

Really?  I don't see how.  You can't pass an object with a `pred' inst to 
something expecting `ground', and (last time I checked) declaring the 
`pragma c_code' to be `pred(...) -> ground' doesn't work either.  If I'm 
missing something, please let me know!

Anyway, the best way to do all this kind of hackery is to get a compiler to 
do it for you.  :-)  Unfortunately, HAL still needs a lot of work before it 
could be practicably useful for something like this.  :-(

Warwick

--------------------------------------------------------------------------
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