From: Michael Lazzaro [mailto:[EMAIL PROTECTED]]
> 
> .... and _I'm_ trying to promote the reuse of the old "oct/hex" 
> functions to do a similar both-way thing, such that:
[...]
> .... but people just aren't biting, so far.  Don't see why 
> not, I think it's keen.

There's the problem Larry mentioned...
>
> 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?

$x = '11';
$y = $x + 1;
$z = hex($x);  # Which is it a string or number?

But I wonder if this couldn't be solved by associating some appropriately
named "string format" property with the numeric value. That is, if
Apocalpyse 2, Properties hasn't changed and we're still allowed to associate
properties with values. And I guess it there'd be good arguments why it'd be
better as a variable property.

So in the above example, after the 2nd line, I'd assume the variable $x
would contain the value 0xa and that that value would have the default
string format property designating a decimal representation. After the 3
line, I'd assume the value would remain 0xa, but instead be converted to a
string using a hexidecimal representation. And that $z would receive a copy
of the value also tagged as stringifying using hexidecimal notation...

And if alternatively, we opted to make this a variable property... $z would
receive a copy of the value, but would stringify using the default decimal
notation.

Reply via email to