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

Construction Type's Syntax

Unread post by Martin Meyer »

Hello Thomas and all,

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

Code: Select all

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
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

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:

Code: Select all

interface special supports general{unsigned} end interface special
And use that in specialClass:

Code: Select all

class specialClass : special end class specialClass
Regards Thomas Linder Puls
PDC
Martin Meyer
VIP Member
Posts: 328
Joined: 14 Nov 2002 0:01

Unread post by Martin Meyer »

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
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

True, and if that difference is significant to you the it will not work.
Regards Thomas Linder Puls
PDC
Post Reply