Open jamiebuilds opened 7 years ago
B
can have its own symbol named a
. Relatedly, it can also implement A.a
for you (that will probably be a common pattern). I don't think any of this is an issue. I'll leave this open for a bit to see if I've missed anything.
But without redeclaring anything would the child protocol copy the symbols from the parent?
It seems natural to assume that this works because of the extends
keyword:
protocol A { a; }
protocol B extends A { b; }
class C implements B {
[B.a]() {} // copy A.a to B.a
[B.b]() {}
}
@thejameskyle It would not copy the symbols. I can see how someone might make that assumption, but the relationship implied between B
and A
by extends
is that, in order to implement B
, one must also implement A
. Would another keyword or symbol make this more clear?
I think another keyword would be a lot clearer. A synonym of "requires" rather than something that implies inheritance would be best I think
I think I would be surprised if the keyword was "extends" and it did not set up a [[Prototype]] chain.
protocol A { a; }
protocol B depends on A { b; }
or, to align with #24
protocol A { a; }
protocol B requires A { b; }
👍 for requires
.
I have some questions about this example:
In this example, implementing
B
seems to require referencing A. I was wondering if it made sense to copy over the properties of A to B:If not, does that mean that
B
can also have it's own symbol nameda
?Or should that be an early error?