Well, anyone who's written a R-D parser by hand would recognise that the patterns feature described for Perl6 will not only replace the regex, but will do unpacking just fine, too! All we need are primitive rules for the items to read, that are binary rather than text. Then we have all the features of patterns and grammar, and can do things like put predicates between the items to grab, make choices, etc. It's exactly the same as a grammar eating string input. It's just a grammar eating groups of concecutive bytes, already possible to express using the stated primitives (e.g. read 4 u0 characters, take their ord's, and produce an int as the return value).
So, are we going to run with it, or come up with a new/different improved unpack() as well?
—John
|
|---|