TSa skribis 2005-09-23 19:11 (+0200):
> >> We have:  "foo" ~ $bar
> >> I see: a juxtaposition of two operators and an item,
> >>        all three separated by whitespace
> >I can only hope you mean two items and one operator.
> So, at last there is hope somewhere. But I fear I'm hopelessly
> drowned in my own misconceptions and really meant two ops and an
> item. But I hope---ahh hope again---that the optimizer boils down
> the "foo" invocation to 'foo' at compile time. Which immediately
> raises the question whether I consider ' ' as an operator or not :)

Ah, the "" operator. But still, "foo" as a whole is an item too. (The
entire expression is too, but I'm not considering that, for simplicity)

> OTOH, I think we agree that a "foo $bar" is parametric with respect
> to $bar and as such requires some code to evaluate it? The same applies
> to matches /foo.*/ which are backed by some code that is build from
> the text between the //. And how is this creation process of a match
> closure parameterizable other then giving the resulting code a parameter
> from which a new closure is created at runtime? And why is this not the
> case for string interpolation? To a certain extent I see these two
> closure manipulations as inverse operations. Interpolation creates
> strings while matching analyzes them. But they don't guarranty mutual
> round-trip invariance.

I have a hard time parsing this. Are you suggesting that interpolation
is somehow translated to a sub call like i("foo ", $bar)?

> Just ranting again a bit of my difficulties of integrating junctions
> into my mental picture. How many times do you expect foo and ~ in
>   "{foo}" ~ $bar
> beeing called? Consider ($bar = 42) versus ($bar = any(1,2,3)).

Once. The foo is not part of the junction, so it is not changing in
different iterations of autothreading.


    sub foo { @_.join(":") }
    my $bar = 2;
    my $baz = foo($bar *= 2, 1|2|3);
    say $bar;

The foo call line evaluates to:

    my $baz = foo(4, 1) | foo(4, 2) | foo(4, 3);
    # Except that the 4 is really $bar, the lvalue return value of *=

not to:

    my $baz = foo($bar *= 2, 1) | foo($bar *= 2, 2) | foo($bar *= 2, 3);

So eventually, "4" is said, not "16", and there is no question of which
$bar *= 2 is evaluated first.


Reply via email to