On Thu, 2004-04-15 at 18:23, Austin Hastings wrote:

> >     @matrix... = <<1 0 0 1>>;

> Keep in mind that you're using a quoting operator. For numbers, you can just
> use (0, 1, 2, 3)
> and probably be better understood. (The <<list of numbers>> approach will
> work, but it will take all the numbers through a string phase first,
> followed by needless conversion.)

I agree with most of what you say, but here, you need to be clearer.

In the case of:

        @matrix = <<1 2 3 4 5>>;

You need only add the type:

        int @matrix = <<1 2 3 4 5>>;

There is no string phase, or at least should never be. The compiler can
pre-compute the list:

        int @matrix = ('1','2','3','4','5');

And it then has another obvious pre-computation to perform:

        int @matrix = (+'1', +'2', +'3', +'4', +'5');

And since everything is a constant, you end up with:

        int @matrix = (1, 2, 3, 4, 5);

It's magic ;-)

The last step above is what I would expect a B::Deparse-like thing for
Perl 6 to produce.

-- 
Aaron Sherman <[EMAIL PROTECTED]>
Senior Systems Engineer and Toolsmith
"It's the sound of a satellite saying, 'get me down!'" -Shriekback


Reply via email to