[m-dev.] taking the address of field access functions

Mark Brown mark at cs.mu.OZ.AU
Mon Jul 3 12:25:19 AEST 2006


On 30-Jun-2006, Ian MacLarty <maclarty at cs.mu.OZ.AU> wrote:
> On Fri, Jun 30, 2006 at 12:32:20PM +1000, Ralph Becket wrote:
> > Ian MacLarty, Friday, 30 June 2006:
> > > Is there some fundamental reason we don't allow passing field access
> > > functions as higher order terms?  I saw some comments in the compiler
> > > saying it wasn't allowed, but non saying *why* it wasn't allowd.  I have
> > > some cases where this would be useful.  Of course I can just define a
> > > wrapper function that calls the field access function, but I don't see
> > > why I shouldn't be able to pass the field access function itself.
> > 
> > The problem is twofold:
> > (1) we don't currently support "taking the address" of multi-moded
> > functions;
> > (2) field access functions are constructed on demand in order to get the
> > modes right regardless of context.
> > 
> 
> Couldn't we do the same thing when constructing a higher order term from
> a field access function?  Surely we'll know the required mode of the
> higher order term being constructed from context,

Not if we need to construct the lambda expression before mode analysis
is done, which is currently what happens.  Solving this problem would also
solve (1), I think, but it wouldn't be easy.

Cheers,
Mark.

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list