Discussions related to Visual Prolog
-
Martin Meyer
- VIP Member
- Posts: 291
- Joined: 14 Nov 2002 0:01
Unread post
by Martin Meyer » 20 Sep 2016 23:48
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
-
Thomas Linder Puls
- VIP Member
- Posts: 1625
- Joined: 28 Feb 2000 0:01
Unread post
by Thomas Linder Puls » 21 Sep 2016 8:12
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: 291
- Joined: 14 Nov 2002 0:01
Unread post
by Martin Meyer » 21 Sep 2016 17:18
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