[mercury-users] `with_inst` to avoid (unimplemented) taking address of pred with multiple modes

obo at ruk.cuni.cz obo at ruk.cuni.cz
Thu Mar 4 04:02:10 AEDT 2004


Hi.

I'm using rotd-2004-01-19 and I'd like to use often a predicate with
multiple modes, the explicit lambda expression is kind of too long
solution to overcome this:

Software Error: sorry, not implemented: taking address of pred
`opt/5' with multiple modes.
(use an explicit lambda expression instead)

If I understand it correctly, I can give names to a predicate modes:

:- type opt(Option) == (pred(Option, string, maybe(character),
                             option_data, maybe(string))).
:- inst opt_long == (pred(uo, in, uo, uo, uo) is semidet).
:- inst opt_short == (pred(uo, uo, in, uo, uo) is semidet).
:- inst opt_defaults == (pred(in, uo, uo, uo, uo) is nondet).
:- inst opt_dump == (pred(uo, uo, uo, uo, uo) is nondet).

Until the mmc is capable of finding the correct mode of the predicate
automatically, one could use `with_inst` hinting:

 use_the_predicate_opt(opt`with_inst`opt_long)

where the opt

:- type my_option.
:- pred opt `with_type` opt(my_option).
:- mode opt `with_inst` opt_long.
:- mode opt `with_inst` opt_short.
...

Would it be easy to implement?

Thanks, O.

--
Ondrej Bojar (mailto:obo at cuni.cz)
http://www.cuni.cz/~obo


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