FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log inLog in 


Construction Type's Syntax

Post new topic   Reply to topic    discuss.visual-prolog.com Forum Index -> Visual Prolog
View previous topic :: View next topic  
Author Message
Martin Meyer



Frankfurt a.M., Germany
Joined: 14 Nov 2002
Posts: 218

PostPosted: 20 Sep 2016 23:48    Post subject: Construction Type's Syntax Reply with quote

Hello Thomas and all,

this code throws a syntax error (in VIP 7502):

interface general{@Type}
    domains
        useType = @Type.
end interface general


interface myDomains
    domains
        special = general{unsigned}.
end interface myDomains


class specialClass : myDomains::special  %the error is here
end class specialClass

implement specialClass
end implement specialClass

However when replacing myDomains::special by general{unsigned} it works fine.

Is there a reason, why myDomains::special cannot be in the place of a construction type? Or could the above syntax be allowed in future VIP versions?

Regards,
Martin
Back to top
View user's profile Send private message
Thomas Linder Puls



Copenhagen, Denmark
Joined: 28 Feb 2000
Posts: 3093

PostPosted: 21 Sep 2016 8:12    Post subject: Reply with quote

It will not be allowed in the next version. And I don't know about the future.

Notice however that you can define and interface instead of a domain:

interface special supports general{unsigned}
end interface special

And use that in specialClass:

class specialClass : special
end class specialClass


_________________
Regards Thomas Linder Puls
Prolog Development Center
Back to top
View user's profile Send private message
Martin Meyer



Frankfurt a.M., Germany
Joined: 14 Nov 2002
Posts: 218

PostPosted: 21 Sep 2016 17:18    Post subject: Reply with quote

Thanks Thomas for the info!

The interface special has a slightly different semantics than the type myDomains::special. The interface special is a subtype of general{unsigned}, while myDomains::special and general{unsigned} are synonym types.

Regards,
Martin
Back to top
View user's profile Send private message
Thomas Linder Puls



Copenhagen, Denmark
Joined: 28 Feb 2000
Posts: 3093

PostPosted: 22 Sep 2016 8:07    Post subject: Reply with quote

True, and if that difference is significant to you the it will not work.
_________________
Regards Thomas Linder Puls
Prolog Development Center
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    discuss.visual-prolog.com Forum Index -> Visual Prolog All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum