David Mitchell wrote:
> Jarkko Hietaniemi wrote:
> > Assume I want
> >
> > $a = 2 + 3i;
> >
> > to work...
>
> Which I what I suggest we abandon attempts to make the parser do intellignet
> decisons on numeric liternal, and instead just grab all the characters
> that appear to make up thye string constant ...
>
> use complex;
> my $c = 2__3; # 2 + 3i
That's really gross. 2 + 3i is just add(integer(2), complex(0,3)) with
compile-time constant folding eliminating the add(). I would even go so
far as to say that 3i is just syntactic sugar for multiply(integer(3),sqrt(-1))
with constant folding doing the simplification. The only rules we need are
the standard ones we must have for constant folding and *one* additional
macro that says bareword "i" used after a scalar should be re-written as
"* sqrt(-1)".
- Ken