Re: [m-users.] IO argument clobbering
Volker Wysk <[email protected]>
| Newsgroups | gmane.comp.lang.mercury.general |
|---|---|
| Message-ID | <[email protected]> |
Am Dienstag, dem 18.07.2023 um 02:09 +1000 schrieb Zoltan Somogyi: > On 2023-07-17 17:43 +02:00 CEST, "Volker Wysk" <[email protected]> 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 _______________________________________________ users mailing list [email protected] https://lists.mercurylang.org/listinfo/users
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6QXGh82Ov3+2nrxp+K4ydFOsHoUFAmS2XaoACgkQ+K4ydFOs HoV/Jg/+JT8IZVQsCWbU2WHgAQCKk36BTc/7Mjb/FYEUZ0apz07LSDQivjOAFAAV Q9BNHLfDn11GAYEavzTaTgYD2YAfeDMEHabGts7RQuxTzS6Q7jaVEZd0WFuJQP4Z lQNnCN/SwE3K4KfuR2p1wkNndzKw4WdjbkGN3hN9KDnBEs03AXjvCjHuKK/YYUkn uQkluJUnSZ3T7Uloy2wV7f17G88TfvzIzggSJVv8wVvWjdFyz1KQhk9WjwZQEP0a aWx3mXh0qV1wl8VhWwxKxXp8D1T8BMAMQaHVphwcyvolnEq5RO9iP/Khoz0/HVGE W72kztEo44c5G0prAot7ETdSmXwv3htOfa931CL/3fR11epMioXPT4TFGUp0Bjz8 vExBwXO2idqDg9vaV4zajsHmDX1+rhlKGABdyenAfSIY5nKZVqXomZzfk4i5jKHq vESCZ7XLXzDtUwUuVxdB4qm5RLyFvRNAmL5Q3kZv8cyHCkD4+q53I/PfsPIBA9tv 4fvQk8z2x8cfVZScQIJEjJMatv1MY+vDjpWR6g6lakq6AlGp399AEZoWh1BB80om YxGYl4RwDjVUgiFnJVWWgn/W7fbUYVAKU6mzNgvVY7jR6yvDflwLUoOD1D99su7G 4ADngefRz7twDD3T7ODBa9t5G0sSUd0aB3bbhnZH+b+GpIVRuSQ= =riaP -----END PGP SIGNATURE-----