[m-users.] IO argument clobbering

Sean Charles (emacstheviking) objitsu at gmail.com
Wed Jul 19 00:33:14 AEST 2023



> On 18 Jul 2023, at 11:08, Richard O'Keefe <raoknz at gmail.com> wrote:
> 
> Two points of pedantry.
> Mercury:  :- type callback == ... is NOT like a preprocessor macro in C.
> It's much closer to a C 'typedef'.

Actually, yes it is. I was aiming low...

> English:  the past participle of 'to grok' is 'grokked', not 'groked'.
> The Groke https://en.wikipedia.org/wiki/The_Groke is not involved.
> https://www.oxfordlearnersdictionaries.com/definition/english/grok

Interesting they didn't mention Stranger In A Strange Land though. I remember reading that, I can still see the flying manta rays.



> 
> I had a bit of trouble getting the hang of higher order insts myself.
> 
> On Tue, 18 Jul 2023 at 21:39, Volker Wysk <post at volker-wysk.de <mailto:post at volker-wysk.de>> wrote:
>> 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 <mailto: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
>> _______________________________________________
>> users mailing list
>> users at lists.mercurylang.org <mailto:users at lists.mercurylang.org>
>> https://lists.mercurylang.org/listinfo/users
> _______________________________________________
> users mailing list
> users at lists.mercurylang.org
> https://lists.mercurylang.org/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20230718/3b7dd40c/attachment.html>


More information about the users mailing list