Re: [m-users.] IO argument clobbering
"Richard O'Keefe" <[email protected]>
| Newsgroups | gmane.comp.lang.mercury.general |
|---|---|
| Message-ID | <CABcYAdK83FSAReY-4u5C=iFK+bnrPe094Y1p0a8jh2=c9R-8-g@mail.gmail.com> |
Two points of pedantry. Mercury: :- type callback == ... is NOT like a preprocessor macro in C. It's much closer to a C 'typedef'. 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 I had a bit of trouble getting the hang of higher order insts myself. On Tue, 18 Jul 2023 at 21:39, Volker Wysk <[email protected]> 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" <[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 > _______________________________________________ users mailing list [email protected] https://lists.mercurylang.org/listinfo/users