Skip to content

Instantly share code, notes, and snippets.

@masak
Created May 12, 2009 08:55
Show Gist options
  • Save masak/110397 to your computer and use it in GitHub Desktop.
Save masak/110397 to your computer and use it in GitHub Desktop.
Arrays and hashes are already in place, but there are a few core data types
that haven't been implemented yet:
* KeyHash
* Set and KeySet
* Bag and KeyBag
* Buf
All but the last are collection types, and Buf is a kind of hybrid between an
unencoded Str and an Array. All of these types suffer from slight
underspecification and a paucity of tests, so implementing them would by
necessity involve a fair amount of test writing and discussion with the Perl 6
design team.
The KeyHash, KeySet, and KeyBag classes are simply behavioral extension of
their respective base classes, automatically deleting entries whenever their
values reach a non-true value. However, Set and Bag still aren't implemented,
and the spec documentation doesn't mention how to create them or how to access
elements in them. Some thinking, discussion and test writing is required.
Another challenge faced in implementing the collection types is making sure
that common idioms and algorithms surrounding sets, bags and hashes can be
easily expressed. As prior art, the Java Collections Framework Tutorial
<http://java.sun.com/docs/books/tutorial/collections/> stands as an example of
how a set of well-thought-out methods on a small number of interfaces and
implementations can interact to create a rich set of possible uses. Where it
makes sense to do so, inspiration can be had from that tutorial.
As to the Buf type, the specified parts are a more extensive, but deliberately
vague <http://gist.github.com/82837>. Here too, implementation will raise a
lot of questions during test writing and implementation.
Observables:
* Tests for Set, Bag, KeyHash, KeySet, and KeyBag
* Tests for Buf
* Implementations of all of the above in Rakudo
S09 is the synopsis about data structures. It covers things such as typed
arrays, multidimensional arrays, user-defined array indexing, and
autovivification.
And it has almost no spectests.
To qualify the above statement, the well-tested synopsis documents (S02-06 and
S12) each have over fifty test files and many hundreds of tests. S09 has five
test files and 141 tests. The things that are tested are the things that have
been implemented wholly or partly by Rakudo (autovivification, subscript
slices, and typed arrays). S09 contains a multitude of things that could be
tested, but aren't yet.
Tests for the following things still need to be written:
* Sized types
* Compact structs
* Fixed-size arrays
* Compact arrays
* Multidimensional arrays
* User-defined indexing
* Adverb-adorned indexing
* Negative and differential subscripting
* Mixed subscripts
* Cascaded subscripting
* Autosorted hashes
It is the case that all of the above features, besides being needed in Rakudo
for it to be released as 6.0.0, would also be very nice for Perl 6 programmers
to have as early as possible. There are likely two reasons they haven't been
implemented already: the first reason is that practically all of them are
reasonably complicated syntactic sugar for things you can already do, albeit
more elaborately. The second reason is that there aren't any spectests for
these features.
This grant aims to rectify the situation by writing spectests for S09. This
will assist the implementation of these features, since implementing a feature
is much less work if the tests are already in place.
Observables:
* Tests for each of the topics listed above
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment