On Thu, Nov 21, 2002 at 01:22:50AM -0500, Tanton Gibbs wrote: > > I actually rather like MikeL's suggestion for the unary ops; clear, > > concise, and highly readable. And look: > > > > my str $s = sprintf("%x", $i); # 30 characters > > my str $s = hex $i; # 19 characters > > my $s = ~hex $i; # 16 characters > > I think these are good, but I really think that Larry's idea of an "as" > function is the best. Not only does it provide a decent syntax > my str $s = $i.as("%x"); > > it also has the ability to be overloaded for various user defined types. >
I do agree that having it be a method (and hence overloadable) is the best solution. I just wish there were some way to get away from those dratted sprintf format strings. --Dks