On Apr 1, 2008, at 13:25 , John M. Dlugosz wrote:
Brandon S. Allbery KF8NH allbery-at-ece.cmu.edu |Perl 6| wrote:
    $stream.print (Buf $record);
> $stream.print($record.pack) # I would think?

A .pack member function on a Compact struct is indeed my first gut feeling, but at the end of the section he states specifically that packing is triggered by coercing to a Buf type.

Since nothing is sacred, I would propose that .pack is more sensible as the basic mechanism, to be used when doing this explicitly. And a conversion operation to Buf can be provided that simply calls .pack().

I can see the point of autocoercion, but (a) that it exists doesn't mean it's the only way to do it (this *is* Perl...), (b) we already have other coercions such as .perl and .yaml so this would be consistent. (Then again, that implies postfix .str instead of/in addition to prefix (~). Hm.)

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon university    KF8NH


Reply via email to