W
William Morgan
Excerpts from Devin Mullins's mail of 8 Jul 2005 (EDT):
Thank you (and Adam Jenkins) for clarifying this.
So the LSP doesn't say anything about constructors (and rightly so IMO).
So we're back to where we started: subtypes of Array can have
non-trivial constructors and #initialize can't be called automatically
for them.
Currently:
- invalid (non-initialized) objects returned by Array#slice
- Array#slice inconsistent with other Array methods
If Array#slice calls #initialize:
- arbitrary restruction on subtype constructor signatures
- Array#slice still inconsistent with other Array methods
If you make Array#slice return an Array:
- no constructor or invalid object issues
- Array methods consistent
I suspect this is a one-line patch to rb_ary_subseq.
Ok, I'm about to spend the weekend with no electricity or running water
thanks to you guys (just kidding!) so no more of this boring thread from
me until Sunday.
Wrong. The LSP says that /objects/ of a subtype have to support the same
interface. That is, it specifically ignores the constructor. That's how
Java gets away with not inheriting the constructor.
Thank you (and Adam Jenkins) for clarifying this.
So the LSP doesn't say anything about constructors (and rightly so IMO).
So we're back to where we started: subtypes of Array can have
non-trivial constructors and #initialize can't be called automatically
for them.
Currently:
- invalid (non-initialized) objects returned by Array#slice
- Array#slice inconsistent with other Array methods
If Array#slice calls #initialize:
- arbitrary restruction on subtype constructor signatures
- Array#slice still inconsistent with other Array methods
If you make Array#slice return an Array:
- no constructor or invalid object issues
- Array methods consistent
I suspect this is a one-line patch to rb_ary_subseq.
Ok, I'm about to spend the weekend with no electricity or running water
thanks to you guys (just kidding!) so no more of this boring thread from
me until Sunday.