> Me:
        [$foo is bar] can change the value of $foo.

> Damian:
        Yes. For example:
        my $foo is persistent;


Could you explain this further please?




> Me:
        $foo : bar baz   is roughly equivalent to   baz(bar($foo))

> Damian:
        Err. No. That would be:
    
            bar(1); baz(1);

        or possibly:

            $_=\$foo; bar(1); baz(1);
        .
        .
        There will, I hope, be a mechanism for pre- and postfixing
        subroutines, but not properties I think.

I'm certainly not suggesting that : be _THE_ way to enable
postfixing of subs. (I would assume you need a character
pair to surround multiple args in the general case anyway,
quite apart from the fact that : doesn't immediately strike
me as a natural looking character for this sort of purpose.)

But the $foo : bar syntax IS (at the very least rather close to)
_A_ postfix sub syntax, whether or not this is currently viewed
as a desirable way to look at it.



> Damian:
        You lost me here. Your ideas for properties are different
        from mine

I didn't mean to suggest any changes whatsoever regarding
properties.

To the extent I understand them, I like them just the way you
have proposed. (Indeed, I thoroughly applaud your influence
on Perl 6. Personally I am rooting for one of my favortite bits
from clos, multimethods, which was covered by one of your
RFCs, but has not yet been raised on the list, though object
inheritance is all about method dispatch as well, so that has
made interesting reading.)

What I was suggesting was to consider broadening what the
$foo : bar style postfix sub syntax allows/assists bar to do,
so that bars can be used to set properties OR do other stuff.

If constraints of what bars can do are deemed appropriate to
ensure adequate performance for the property setting case,
which is after all, in the first place, the motivation for the syntax,
and in the second, the foreseeable primary use, well, so be it.

Otherwise, I see a possibly interesting twist in which bar can
do things beyond property setting, in particular, change $foo's
value.

Once one takes that step, : can become a generalized "apply
to value(s)" character, and the next natural step is:

    @foo := bar;    # iterate over @foo, applying bar to values.

One character, one concept ("apply to value(s)"), used for two
purposes that I think might not ever get in the way of each
other. (Though I'm not sure about that -- that's what this thread
was intended to help determine.)

Finally, and really a distinct point, I would like to see a distinct
term for value properties that doesn't use the word properties.
I liked the metaphor of post-it notes, and, if bars were to end
up being allowed to be an idiosyncratic but handy form of
postfix sub, then "postit" or similar would, imo, be a natural
name for value properties. Indeed, I think this may be true
even if bars remain constrained to setting postits, er, properties.

Reply via email to