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

Problem with incompatible types

Unread post by Martin Meyer »

Hello Thomas,

please have a look at below stripped down version of my code. It throws error c504 : The expression has type 'syntax_t_nt::grammarSymbol{::unsigned, ::unsigned}', which is incompatible with the type 'syntax_t_nt::grammarSymbol{@Terminal, @Nonterminal}' in VIP 8.0.0. How can I circumvent the problem?

Code: Select all

interface syntax_t_nt{@Terminal, @Nonterminal}   domains     grammarSymbol =         t(@Terminal T);         nt(@Nonterminal Nt).     grammarString = grammarSymbol*.   end interface syntax_t_nt   %======   interface cfg{@Terminal, @Nonterminal}     open syntax_t_nt{@Terminal, @Nonterminal}   predicates     isNullable : (grammarString GrmStrg) determ.   end interface cfg   %======   interface cfgSupportSite{@Terminal, @Nonterminal}   predicates from cfg{@Terminal, @Nonterminal}     isNullable/1   end interface cfgSupportSite   %======   class unsignedCfg : cfg{unsigned, unsigned} end class unsignedCfg   %---   implement unsignedCfg     open syntax_t_nt{unsigned, unsigned}     supports cfgSupportSite{unsigned, unsigned}   clauses     isNullable([nt(Nt) | RestGrmStrg]) :- %the error refers to nt(Nt) in this line         doSomethingWithAnUnsigned(Nt),         isNullable(RestGrmStrg).       isNullable([]).   predicates     doSomethingWithAnUnsigned : (unsigned). clauses     doSomethingWithAnUnsigned(_).   end implement unsignedCfg   %======   implement main   clauses     run() :-         _ = unsignedCfg::new().   end implement main
Regards Martin
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

In this particular case a workaround is not to use open in the cfg interface:

We will of course look for a non-workaround solution as well.
Regards Thomas Linder Puls
PDC
Martin Meyer
VIP Member
Posts: 328
Joined: 14 Nov 2002 0:01

Unread post by Martin Meyer »

Thank you! I followed your advice and it works now.
Regards Martin
Post Reply