Re: String to Num (was Re: Numeric Literals (Summary))

[email protected] (Dave Storrs) Wed, 20 Nov 2002 21:34:01 -0800
Newsgroups perl.perl6.documentation
Message-ID <[email protected]>
On Wed, Nov 20, 2002 at 01:23:04PM -0800, Dave Whipp wrote:
> 
> "Larry Wall" <[email protected]> wrote in message
> news:[email protected]...
> > On Wed, Nov 20, 2002 at 11:57:33AM -0800, Michael Lazzaro wrote:
> > : .... and _I'm_ trying to promote the reuse of the old "oct/hex"
> > : functions to do a similar both-way thing, such that:
> >
> > What's a two-way function supposed to return if you pass it something
> > that has both a string and a numeric value?  Convert it both directions?
> 
> It returns a junction, of course ;-)


D'oh!  Another Dave anticipated me!  That'll teach me to read the
whole thread before responding.  (Oh well, at least our smileys were
different.)


> Seriously though, I dislike the proposal. Of course, if we have a
> 'do-it-as-a-string' operator modifier (As discussed for bitops, etc), then
> we could have:
> 
>   ~hex(10) eq 'a'
>   hex(10) eq '16'
> 
> But I still tend to read that ~ as a 1's complement.

Fwiw, I suspect that the ~ will be used more often as stringification
than as 1's complement, so people will fairly quickly remap their
brains to the new meaning.


--Dks