[m-users.] IO argument clobbering

Zoltan Somogyi zoltan.somogyi at runbox.com
Tue Jul 18 19:55:17 AEST 2023


On 2023-07-18 11:44 +02:00 CEST, "Volker Wysk" <post at volker-wysk.de> wrote:
> Am Dienstag, dem 18.07.2023 um 18:32 +1000 schrieb Peter Wang:
>> To clarify, you CAN approximate a higher-order term with the inst `ground',
>> because the term has no variables (variables essentially meaning "holes"
>> in the term that are not yet filled in).
>> 
>> What you can't do is CALL a higher-order term approximated by `ground'
>> because `ground' does not include any higher-order inst information.
> 
> Hmmm... Why would you want to approximate a higher order inst with a ground
> inst? Isn't calling the term as a function or predicate the only thing you
> can do with it?

You wouldn't WANT to, but sometimes, as with the code that started off
this email thread, you DO, because you either don't KNOW that you have to
specify the higher order inst for the higher order value, or because you
simplify forget.

When you write "callback::in" as the type and mode of an argument,
the type says that the only thing you can do with the argument is call it,
but the inst says you can't call it, because the compiler does not know
the modes of the predicate's arguments. (In the original example, callback
is a predicate type, but the same would be true for any function whose mode
was not the standard function mode.) This is obviously :-) a problem.

Peter is right; this issue needs better explanation in the error messages
that it gives rise to. I will look into it.

Zoltan.


More information about the users mailing list