4

Flora-2 is an eccentric language and I know this is a long shot but I haven't found any active resources devoted to it so I'm trying here. Its so popular... there is no stackoverflow tag for it. If you know anything about the status and future of Flora-2 and XSB Prolog, I'd love to hear that, too.

Can someone explain Flora-2 diamond-inheritance rules to me? The manual has an example but doesn't show the results of the example. The wording seems to be the opposite of what I see in the interpreter and in the diamond.flr demo. Here's the demo:

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

?- ?X[?Y->?Z].

(What I see happens with or without the base class c)

The manual says:

At the level of methods of arity > 1, a conflict is considered to have taken place if there are two non-overwritten definitions of the same method attached to two different superclasses. When deciding whether a conflict has taken place we disregard the arguments of the method. For instance, in

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

a multiple inheritance conflict has taken place even though in one case the method m is applied to object k, while in the other it is applied to object u.

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

So I take that to mean that the inheritance of f has a conflict so its undefined (although I'm a bit confused about what 'undefined' means, in a related section it says "inheritance does not take place"). Here's what I get when I run the diamond:

?X = o
?Y = f
?Z = g

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

I expected only the first solution, although I'd think that the second solution would at least make some sense if it also had the solution

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

... but it didn't.

FYI, I'm using the latest stable XSB and the latest Flora-2 release... 0.95.

Chetter Hummin
  • 6,687
  • 8
  • 32
  • 44
Dave
  • 7,589
  • 12
  • 36
  • 42

2 Answers2

2

Stumbled upon this 2+ years after the question was asked. You should have asked it on the flora-users mailing list.

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

?X = o

?Y = f

?Z = g

That is, the two conflicting inheritances canceled each other out, as the manual describes.

Community
  • 1
  • 1
1

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

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

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

Paulo Moura
  • 18,373
  • 3
  • 23
  • 33
  • Thanks but I'm really looking for information on how Flora-2 resolves the problem and why -- the well-founded semantics should be able to resolve this conflict as undefined but that's not happening. I've reproduced the behavior with an older version of XSB and even on UNIX so its either me or the compiler never really worked in the first place. Thanks. – Dave Apr 04 '11 at 23:23
  • did you see the same problewith latest 1.2version ? – Dmitry Ponyatov May 03 '17 at 04:22
  • Did yoy have any problems with eclipse visualizer plugin ? I can't make them see my flora install under win32 – Dmitry Ponyatov May 03 '17 at 04:24