Hello Thomas,
stating that an interface A supports an interface B extends A by all predicates and properties of B. But it does not extend A by the domains of B.
Since the feature of parametrizing interfaces by scope type variables has been introduced, it can cause inconveniences, that A is not extended by B's domains. It is, when B has a list of scope type variables, which is in A's support qualification assigned to some -lengthy, nested, complicated- list of types.
This -lengthy, nested..- type assignment list must be repeated in the code, when using a domain declared in B in the context of the scope type assignments made in A. The issue turns out even worse, when its not only two interfaces but a supports-chain of interfaces, where each one contributes some scope type assignments to the next.
In my opinion it would be better, when the supports qualification also extended interfaces' types. Maybe you plan already for such change in future version?
Many regards,
Martin
-
- VIP Member
- Posts: 1466
- Joined: 28 Feb 2000 0:01
-
- VIP Member
- Posts: 354
- Joined: 14 Nov 2002 0:01
Below is an example of a supports-chain of three interfaces:
- - 1st interface is some generic map (myGenericMapM{@Key, @Data}),
- 2nd one uses 1st one to construct a map of companies (companyMapM),
- 3rd one uses 2nd and 1st to declare a map of employees per company (employeeMapM).
Code: Select all
interface myGenericMapM{@Key, @Data}
% insert, delete, etc. predicates could be here
domains
tree =
empty;
node(@Key, @Data, tree LeftChild, tree RightChild).
properties
algebraicRep : tree (o).
end interface myGenericMapM
class myGenericMapM{@Key, @Data} : myGenericMapM{@Key, @Data}
end class myGenericMapM
implement myGenericMapM{@Key, @Data}
facts
algebraicRep : tree := empty.
end implement myGenericMapM
%---------
interface companyMapM{@CompanyData}
supports myGenericMapM{string CompanyName, @CompanyData}
end interface companyMapM
class companyMapM{@CompanyData} : companyMapM{@CompanyData}
end class companyMapM
implement companyMapM{@CompanyData}
inherits myGenericMapM{string CompanyName, @CompanyData}
end implement companyMapM
%---------
interface employeeMapM
supports companyMapM{myGenericMapM{unsigned EmployeeID, string EmployeeName}}
end interface employeeMapM
class employeeMapM : employeeMapM
end class employeeMapM
implement employeeMapM
inherits companyMapM{myGenericMapM{unsigned EmployeeID, string EmployeeName}}
end implement employeeMapM
%---------
implement main
clauses
run():-
console::init(),
EmployeeMapM = employeeMapM::new(),
Tree = EmployeeMapM:algebraicRep,
% I would want to code here:
% if Tree = employeeMapM::empty then
% however that doesn't work out, instead it must be:
if Tree = myGenericMapM{string, myGenericMapM{unsigned, string}}::empty then
stdIo::write("employeeMap is empty")
end if.
end implement main
goal
mainExe::run(main::run).
-
- VIP Member
- Posts: 1466
- Joined: 28 Feb 2000 0:01
OK, I see the problem.
Have you however tried writing like this instead:
Have you however tried writing like this instead:
Code: Select all
if Tree = myGenericMapM{_, _}::empty then
stdIo::write("employeeMap is empty")
end if.
Regards Thomas Linder Puls
PDC
PDC
-
- VIP Member
- Posts: 354
- Joined: 14 Nov 2002 0:01
-
- VIP Member
- Posts: 1466
- Joined: 28 Feb 2000 0:01
-
- VIP Member
- Posts: 354
- Joined: 14 Nov 2002 0:01