But, if the whole pack/unpack thing is moved out of the core, why does there have to be only one way to do it?.
That is, suppose the existing pack/unpack functions were supplied externally and you pulled it in, if desired, with use Legacy::Packing qw/pack unpack/;. You could have a totally different, unrelated, body of code to implement something fancy like RFC 142. There could be many different modules for this purpose.
OK, now here's my meta-feature.
Define a overall standard way to register types used for packing/unpacking. All pack/unpack type of modules would look in this same place for these definitions.
So, suppose I write class MyType and include methods to serialize and unserialize in a binary form. As the creator of that class, registering this fact once should make it available to any packing module.
Perhaps, ${^PACKING}{MyType}= [\&from_sub, \&to_sub ]; (using the current Perl5 syntax).
Now whether someone uses RFC 142's module and refers to that typename in a definition, or someone does a (hypothetical) Legacy::Packing->addtype (e => 'MyType');, that definition is available and more importantly, written by that type's provider.
—John
In reply to Perl 6 wish list: pack/unpack meta-feature by John M. Dlugosz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |