Page 1 of 1

Domains specification in both .i and .cl files

Posted: 24 May 2020 16:37
by Harrison Pratt
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

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

Posted: 24 May 2020 21:50
by Martin Meyer
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

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

Posted: 25 May 2020 11:20
by Harrison Pratt
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.

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

Posted: 26 May 2020 8:00
by Thomas Linder Puls
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.