M
Michele Dondi
To be fair I had the idea I'm about to expose while developing a new
japh of mine (the one about which I'm talking in my other post),
though I think that this may be useful in "production" code too...
Coming to the point, it often happens to resort to "cascaded"
[un]pack()s. In my specific case I have
$coded=pack 'u', pack 'w', $something;
and respectively
$something=unpack 'w', unpack 'u', $coded;
but even longer combinations are possible/common. Now I understand
that this stresses the natural order in which transformations are
applied, though I wonder if templates could be cascaded instead, by
means of a new metacharachter, e.g. C<:>, a la
$coded=pack 'u:w', $something; # Or perhaps 'w:u'
$something=unpack 'w:u', $coded; # 'u:w'?
Should this be considered too error-prone or undesirable for any
reason, disambiguation may come from supplying "cascaded" parameters
by means of a different data type, a la
$coded=pack ['u', 'w'], $something; # Or perhaps 'w:u'
$coded=unpack ['w', 'u'], $something; # 'u:w'?
Any thought?
Michele
japh of mine (the one about which I'm talking in my other post),
though I think that this may be useful in "production" code too...
Coming to the point, it often happens to resort to "cascaded"
[un]pack()s. In my specific case I have
$coded=pack 'u', pack 'w', $something;
and respectively
$something=unpack 'w', unpack 'u', $coded;
but even longer combinations are possible/common. Now I understand
that this stresses the natural order in which transformations are
applied, though I wonder if templates could be cascaded instead, by
means of a new metacharachter, e.g. C<:>, a la
$coded=pack 'u:w', $something; # Or perhaps 'w:u'
$something=unpack 'w:u', $coded; # 'u:w'?
Should this be considered too error-prone or undesirable for any
reason, disambiguation may come from supplying "cascaded" parameters
by means of a different data type, a la
$coded=pack ['u', 'w'], $something; # Or perhaps 'w:u'
$coded=unpack ['w', 'u'], $something; # 'u:w'?
Any thought?
Michele