Re: Help! Strings -> Numbers
[email protected] ("Tanton Gibbs") Thu, 21 Nov 2002 01:22:50 -0500
| Newsgroups | perl.perl6.documentation |
|---|---|
| Message-ID | <049c01c29126$6ad628c0$3bd02143@brooklyn> |
> 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.