Domains specification in both .i and .cl files

Discussions related to Visual Prolog
Harrison Pratt
VIP Member
Posts: 336
Joined: 5 Nov 2000 0:01

Domains specification in both .i and .cl files

Unread post by Harrison Pratt » 24 May 2020 16:37

Is there a way to expose a user-defined domain in both the .i and .cl files of a class that doesn't require using an additional 'helper' class (faceHelper.cl in the example below)?

I get error e205 Unknown domain/interface 'expressionDOM' in pack 'main.pack' face.i if I define the domain only in the .cl file, and a similar error if define it only in the .i file. Of course, defining the same domain in both the .i and .cl files is forbidden.

Code: Select all

class face : face     open core %domains %    expressionDOM = smiling; frowning. constructors     new : (faceHelper::expressionDOM). end class face

Code: Select all

interface face     open core predicates     setExpression : (faceHelper::expressionDOM).     getExpression : () -> faceHelper::expressionDOM. end interface face

Code: Select all

implement face     open core, faceHelper %domains %    expressionDOM = smiling; frowning. facts     expression : expressionDOM := erroneous. clauses     new(Exp) :- expression := Exp.       setExpression(Exp) :- expression := Exp.       getExpression() = expression.   end implement face

Code: Select all

class faceHelper     open core domains     expressionDOM = smiling; frowning. end class faceHelper

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

Re: Domains specification in both .i and .cl files

Unread post by Martin Meyer » 24 May 2020 21:50

Hello Harrison,

defining domain expressionDOM in the face interface it works without the helper class:

Code: Select all

interface face   domains     expressionDOM = smiling; frowning.   predicates     setExpression : (expressionDOM).     getExpression : () -> expressionDOM.   end interface face   %---   class face : face   constructors     new : (expressionDOM).   end class face   %---   implement face   facts     expression : expressionDOM.   clauses     new(Exp) :-         expression := Exp.   clauses     setExpression(Exp) :-         expression := Exp.   clauses     getExpression() = expression.   end implement face
Regards Martin

Harrison Pratt
VIP Member
Posts: 336
Joined: 5 Nov 2000 0:01

Re: Domains specification in both .i and .cl files

Unread post by Harrison Pratt » 25 May 2020 11:20

Thanks, Martin!

Putting the domain declaration in the .i file works OK today, but that produced the error messages I posted above. I was testing in a minimal VIP 905 console app to sort out the same error that I was getting in another project ... very strange.

Thanks again,
Harrison

Addendum: The project I was working on (not the test 'face' project here) also started compiling normally. Perhaps 9x might not get everything updated on a timely basis.

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

Re: Domains specification in both .i and .cl files

Unread post by Thomas Linder Puls » 26 May 2020 8:00

Sometimes you may see errors that comes from lacking #include directives. The #include directive may have been inserted automatically, but too late the error was already listed. Building again usually solves that kind of problems.
Regards Thomas Linder Puls
PDC

Post Reply