[m-users.] IO argument clobbering
Volker Wysk
post at volker-wysk.de
Tue Jul 18 19:38:50 AEST 2023
Am Dienstag, dem 18.07.2023 um 02:09 +1000 schrieb Zoltan Somogyi:
> On 2023-07-17 17:43 +02:00 CEST, "Volker Wysk" <post at volker-wysk.de> wrote:
> > Am Montag, dem 17.07.2023 um 17:39 +0200 schrieb Volker Wysk:
> > > But the "in(callback)" inst isn't ground. It's a higher order inst. Only
> > > the "in" with zero arguments is an abbreviation for "in(ground)".
> >
> > Hmmm... Looks like I was confused about what "ground" means.
>
> In different contexts, "ground" means several related and similar
> but nevertheless slightly different things. Which meaning of "ground" people
> mean when they write that term is *usually* clear from the context, but not always.
>
> The standard meaning in logic programming theory is simply "a term that
> contains no variables", and all uses of "ground" include this meaning. But Mercury
> goes beyond standard logic programming theory by having types,
> including higher order types. When you write "ground" in a Mercury program,
> that occurrence of "ground" describes a term that contains
> no variables AND whose type is either not a higher order type,
> or is a higher order function type with the standard function mode
> (which is: all arguments are input, the return value is output).
> It cannot be a higher order predicate type, or a higher order function
> type with a nonstandard mode, because for those, you need to tell
> the compiler the modes of their arguments. If you don't give the compiler
> this info, you get the error message that started this thread.
>
> There is a similar issue with respect to uniqueness. The inst "ground"
> describes a reference to a term that contains no variables, and is not
> the only reference to that term. If you want to describe a reference
> to a term that contains no variables but it IS the only reference
> to that term, what you write is "unique".
>
> Internally in the Mercury compiler, the representation of ground
> insts is parameterised by the absence/presence of both uniqueness
> and higher order inst information. The "ground" inst in Mercury programs
> corrresponds to the absence of both of these kinds of information.
> And yet the compiler's name even for insts with one or both
> of these kinds of information is still "ground". So you see, even
> the Mercury language and the Mercury compiler disagree on
> which variant meaning should be called "ground" :-)
Okay, now I've groked what a "ground term" and a "ground inst" is in
Mercury. Thank you for the explanation.
Regards,
Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mercurylang.org/archives/users/attachments/20230718/744cb76c/attachment.sig>
More information about the users
mailing list