> 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.
>
What's the practical utility of this? This discussion has been pretty
abstract so far... It's easy to see how properties can be used, since we've
already used attributes in p5 for all kinds of stuff. Can you give an
example or two of problems (with code) that the generalised postfix sub
syntax would make easier to solve?

> 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.
>
Actually, Larry has already indicated in an earlier message to the list that
':' will work a lot like that! The examples he has shown to date basically
allow ':' to be a modifier to allow element-wise array operations, much
like:

  http://dev.perl.org/rfc/82.html

A good way to understand the possibilities with this kind of syntax is to
examine other languages that allow their 'verbs' (operators / subroutines)
to be modified by 'adverbs'. J and APL are probably the definitive source
here. Although they don't need a ':' adverb, since they by _default_ apply
all operations across an array argument, you can imagine how Perl could
benefit from an insert adverb:

  http://www.jsoftware.com/primer/insert_adverb.htm

or a table adverb:

  http://www.jsoftware.com/primer/table_adverb.htm


Reply via email to