Open jemc opened 8 years ago
I'm going to assign myself to this one.
I've experimented with a few ideas and I think I'm going to split them into two actual RFCs: the first about tidying up the Seq
interface and resolving some inconsistencies between different sequences (e.g. Array.remove
vs. String.remove
), and the second about sequence views. Since I expect the changes I'll propose to be much more comfortable to use with subtype checking and generic type inference implemented, I'll implement these before jumping back into sequence stuff.
@Praetonus before implementing subtype checking and generic type inference, you may want to rebase and work from on top of my refer
pass branch (https://github.com/ponylang/ponyc/pull/1715) to avoid a lot of merge conflicts later.
As discussed on the sync call, we want to audit the
Seq
interface, as it currently contains a lot of methods that make extra assumptions about what kind of sequence is being dealt with, whether it has a fixed size, whether the underlying pointer can be resized, etc.In the upcoming value-dependent type changes, we will have a
Vector
type with a fixed size that won't be compatible withSeq
as it currently stands.I would suggest reducing the number of methods in
Seq
and possibly adding other interfaces to coverSeq
s that have a size that isn't fixed, and the ability to reserve more space in the pointed-to-buffer.There was already an audit performed in https://github.com/ponylang/ponyc/issues/1131, so this just needs an RFC.