Interfaces
Suppose there are two interface types, J1 and J2, and the following
dispatching subprogramms:
procedure Foo (Obj : J1);
procedure Foo (Obj : J2;
T implements both J1 and J2, and provides a body for
procedure Foo (Obj : T);
As far as I understand the Ada 200x spec, this subprogram declaration
overrides both versions of Foo, such that
Foo ((J1 (T_Obj));
Foo ((J2 (T_Obj));
invoke the same subprogram. Is this correct?
I don't think this is a desirable approach because it makes interfaces
a strictly non-modular concept, and might force library designers to
add unique prefixes to interface subprogram names.
.
Relevant Pages
- Re: Interfaces
... > Suppose there are two interface types, J1 and J2, and the following ... > procedure Foo; ... > As far as I understand the Ada 200x spec, this subprogram declaration ... > add unique prefixes to interface subprogram names. ... (comp.lang.ada) - Re: Interfaces
... >> overrides both versions of Foo, ... >> invoke the same subprogram. ... Do_Something invokes Foo on Obj. ... Do_Another_Thing, which also invokes Foo: ... (comp.lang.ada) - Re: Interfaces
... > procedure Foo; ... > As far as I understand the Ada 200x spec, this subprogram declaration ... (for example, Bar overrides Foo, because somewhere in the chain of ... Ada's interfaces were modeled primarily after Java's interfaces, ... (comp.lang.ada) - Re: Interfaces
... > procedure Foo; ... > As far as I understand the Ada 200x spec, this subprogram declaration ... so I don't think the overriding subprogram provided ... (comp.lang.ada) - Re: 7.0 wishlist?
... The "auto-implement" is intended mainly for the odd situation where an existing class you can't edit fits some interface and you're willing to take responsibility for it if it turns out not to actually adhere to the contract, and try using it where that interface type is expected. ... If reference declarations started showing up with the odd asterisk, bang, or other punctuation mark on it, but never primitive declarations, people would probably be able to guess what was going on, on the basis of "what other binary flag might be set on references but not primitives and would be really useful besides can be/cannot be null?" ... the compiler cannot prove by static analysis that the RHS isn't null might be a good idea. ... Object foo, bar; ... (comp.lang.java.programmer) |
|