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

Interface level bounded polymorphism problem

Unread post by Martin Meyer »

Hello Thomas,

am sorry to bother again with bounded polymorphism, but please have a look on below case (in build 902):

Code: Select all

interface rule   properties     name : string (o).   end interface rule   %===   interface grammar{@RuleSite}   %properties %    ruleList : @RuleSite*.   predicates     getRule_nd : () -> @RuleSite nondeterm.   predicates     tryGetRule : (string Name) -> @RuleSite determ.   end interface grammar   %===   interface grammarSupportSite{@RuleSite}   %properties from grammar{@RuleSite} %    ruleList   predicates from grammar{@RuleSite}     getRule_nd/0->   end interface grammarSupportSite   %===   interface grammarSupport{@RuleSite}   predicates from grammar{@RuleSite}     tryGetRule/1->   end interface grammarSupport   %---   class grammarSupport{@RuleSite} : grammarSupport{@RuleSite}     where @RuleSite supports rule   constructors     new : (grammarSupportSite{@RuleSite} Site).   end class grammarSupport   %---   implement grammarSupport{@RuleSite}     supports grammarSupportSite{@RuleSite}   facts     grammarSite : grammarSupportSite{@RuleSite}.     ruleTree : redBlackTree::tree{string, @RuleSite} := redBlackTree::emptyUnique().   delegate     interface grammarSupportSite{@RuleSite} to grammarSite   clauses     new(Site) :-         grammarSite := Site,         foreach Rule = getRule_nd() do % throws error c504: The expression has type 'Rule$',                                                            % which is incompatible with the type '@RuleSite'             ruleTree := redBlackTree::insert(ruleTree, Rule:name, Rule)         end foreach.   clauses     tryGetRule(Name) = redBlackTree::tryLookUp(ruleTree, Name).   end implement grammarSupport
Interesting is, that when the four outcommented lines for the ruleList property are enabled, then it compiles.
Regards Martin
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Re: Interface level bounded polymorphism problem

Unread post by Thomas Linder Puls »

Well, there is something wrong here, we will look at it.
Regards Thomas Linder Puls
PDC
Post Reply