[mercury-users] $pred doesn't work in lambda expressions
Paul Bone
pbone at csse.unimelb.edu.au
Thu Jul 24 11:26:00 AEST 2008
On Thu, Jul 24, 2008 at 10:55:14AM +1000, Peter Wang wrote:
> On 2008-06-26, Peter Wang <novalazy at gmail.com> wrote:
> > On 2008-06-26, Nicholas Nethercote <njn at csse.unimelb.edu.au> wrote:
> > >
> > > Hi,
> > >
> > > I tried using $pred in a lambda expression and got this:
> > >
> > > Uncaught Mercury exception:
> > > Software Error: hlds_code_util.m: Unexpected: cons_id_to_tag: implementation_defined_const
> > >
> > > It's easy to work around, but I thought it might be worth mentioning.
> >
> > Thanks for pointing it out. Added to the bug tracker.
>
> This was fixed about a month ago. However,
>
> main(!IO) :-
> P = (pred(!.IO::di, !:IO::uo) is det :-
> io.write_string($pred, !IO),
> io.nl(!IO)
> ),
> P(!IO).
>
> will print
>
> predicate `pre.main'/2
>
Is it printing the name of the predicate that defined the lambda
expression (the closure's parent environment) or the name of the
predicate that is calling the lambda expression.
The second is more-incorrect than the first.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/users/attachments/20080724/7087ba6d/attachment.sig>
More information about the users
mailing list