Problem picking a predicate of certain arity

Discussions related to Visual Prolog
Martin Meyer
VIP Member
Posts: 294
Joined: 14 Nov 2002 0:01

Problem picking a predicate of certain arity

Unread post by Martin Meyer » 3 Jun 2019 0:20

Hello Thomas,

just a minor issue: In below code the compiler (build 902) preferes wrong predicate getRule_nd/1-> over the correct getRule_nd/0-> which comes through an interface delegation. I am not absolutely sure, but I suppose that it is not intended.

Code: Select all

interface rule end interface rule   %===   interface grammar     [presenter]   predicates     getRule_nd : () -> rule nondeterm.   predicates     getRule_nd : (symbol Head) -> rule nondeterm.   end interface grammar   %===   interface grammarSupportSite   predicates from grammar     getRule_nd/0->   end interface grammarSupportSite   %===   interface grammarSupport     [presenter]   predicates from grammar     getRule_nd/1->   end interface grammarSupport   %---   class grammarSupport : grammarSupport   constructors     new : (grammarSupportSite Site).   end class grammarSupport   %---   implement grammarSupport   facts     grammarSite : grammarSupportSite.   delegate     interface grammarSupportSite to grammarSite   clauses     new(Site) :-         grammarSite := Site.   clauses     getRule_nd(_Head) = _Rule :-         fail.   clauses     presenter() = presenter::mkPresenter_set(getRule_nd). % Throws error c603 :                                                                                               % The flow pattern '()' does not exist                                                                                               % for 'grammarSupport::getRule_nd/1->'   end implement grammarSupport
Regards Martin

User avatar
Thomas Linder Puls
VIP Member
Posts: 2447
Joined: 28 Feb 2000 0:01

Re: Problem picking a predicate of certain arity

Unread post by Thomas Linder Puls » 3 Jun 2019 21:16

Martin Meyer wrote: I am not absolutely sure, but I suppose that it is not intended.
Well, actually I am not sure either (yet). There are a bunch of rules about conflicts and visibility, etc. that are supposed to deal with these matters.

In any case you can solve your problem by referencing the fact predicate explicitly (instead of relying on the delegation):

Code: Select all

clauses     presenter() = presenter::mkPresenter_set(grammarSite:getRule_nd).
Regards Thomas Linder Puls
PDC

Martin Meyer
VIP Member
Posts: 294
Joined: 14 Nov 2002 0:01

Re: Problem picking a predicate of certain arity

Unread post by Martin Meyer » 4 Jun 2019 1:09

Thank you, I followed your advice.
Regards Martin

Post Reply