Diamond application Flora-2

Flora 2 is an eccentric language, and I know this is a long shot, but I have not found any active resources dedicated to this, so I am trying here. Its so popular ... there is no stackoverflow tag for it. If you know something about the status and future of Flora-2 and XSB Prolog, I would love to hear that too.

Can someone explain to me the rules of Florida-2? The manual provides an example, but the results of the example are not shown. The wording seems to be the opposite of what I see in the interpreter and the demo version of diamond.flr. Here's a demo:

c[f*->g]. c1[f(a)*->a]::c. c2[f(b)*->b]::c. o:c1. o:c2. ?- ?X[?Y->?Z]. 

(What I see happening with or without a base class)

The manual says:

At the level of methods arity> 1, it is believed that a conflict occurs if there are two unwritten definitions of the same method associated with two different superclasses. When deciding whether there was a conflict, we ignore the arguments of the method. For example, in

 a:c. c[m(k)*->f]. a:d. d[m(u)*->f]. 

There was a conflict with multiple inheritance, although in one case the method m is applied to the object k, and in the other to the object u.

(I'm sure they mean arity> = 1, but the results are similar for arity 2)

So, I suppose this means that the inheritance of f has a conflict, so its undefined (although I'm a little confused by what it means "undefined", the relevant section says: "Inheritance does not execute place"). Here is what I get when I run a diamond:

 ?X = o ?Y = f ?Z = g ?X = o ?Y = f(a) ?Z = a 

I expected only the first solution, although I would have thought that the second solution at least makes sense if it also has a solution

 ?X = o ?Y = f(b) ?Z = b 

... but it is not.

FYI, I use the latest stable XSB and the latest version of Flora-2 ... 0.95.

+4
source share
2 answers

I came across this 2 years after the question was asked. You should have asked about this on the Flora Users mailing list.

Anyway, this seems to have been a bug in this version of Flora-2. I see that the current version gives the correct answer

? X = o

? Y = f

? Z = g

That is, two conflicting inheritances cancel each other out, as described in the manual.

+2
source

I am not familiar with the syntax of Flora-2, but I have a familiar example of a known problem with diamond inheritance in Logtalk. You can find it here:

https://github.com/LogtalkDotOrg/logtalk3/tree/master/examples/diamonds

See NOTES.txt and the source file for information on semantics, default inheritance rules, and overriding default inheritance rules. You can run the example using the latest version of CVS XSB. See the SCRIPT.txt file for sample requests.

+1
source

Source: https://habr.com/ru/post/1346320/


All Articles