Page 1 of 1

Problem picking a predicate of certain arity

Posted: 3 Jun 2019 0:20
by Martin Meyer
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

Re: Problem picking a predicate of certain arity

Posted: 3 Jun 2019 21:16
by Thomas Linder Puls
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).

Re: Problem picking a predicate of certain arity

Posted: 4 Jun 2019 1:09
by Martin Meyer
Thank you, I followed your advice.