ponylang / rfcs

RFCs for changes to Pony
https://ponylang.io/
59 stars 48 forks source link

Make Seq type less restrictive, based on audit. #61

Open jemc opened 7 years ago

jemc commented 7 years ago

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 with Seq as it currently stands.

I would suggest reducing the number of methods in Seq and possibly adding other interfaces to cover Seqs 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.

Praetonus commented 7 years ago

I'm going to assign myself to this one.

Praetonus commented 7 years ago

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.

jemc commented 7 years ago

@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.