Now although it is a little annoying that we have to sprinkle a little bit of extra syntax to let the compiler know exactly what type it is working with, it is also forcing a very good pattern on us. The prefix
parser only works for collections whose SubSequence
is equal to itself. Such collections are able to mutate themselves in an efficient manner because they operate on views of a shared storage rather than make needless copies all over the place.
This is why we are forced to provide array slices and substrings as input to these parsers, because it allows them to do their work in the most efficient way possible.