> Simplifying somewhat (ok, a heck of a lot), an rvalued: > > $foo is bar > > or > > $foo : bar > > is syntactic sugar for: > > bar($foo) > > with some extra magic for handling a properties hash > associated with $foo's value, in particular resetting the > hash when $foo's value changes. > > Right? No. I do not think $foo will be passed to the bar handler like that. > Basically, perl will (do the equivalent of) define a sub bar > if it doesn't exist, then call bar, and bar can attach some > data to the value in $foo, or update some data attached > to the value in $foo, and will always return $foo. > > Right? Yes. > If I got the above badly wrong, the rest of this post > probably won't make sense. > > I also presume it would make sense to alias $_ to $foo > in (the method associated with) bar. (Is that intended?) There will need to be some way to access the referent that the property handler is invoked upon. Passing a reference to it in $_ might be one such way. > One could generalize so that bar can do as above, but > doesn't _have_ to do as above, ie it doesn't have to > attach data to $foo's value or update that data; Yes. For example, it might just write out a log message (indicating that $foo has been declared) or it might set some other variable indicating that $foo has been bar'red. > it can return a value other than $foo; I would not expect that this would be allowed. > and it can change the value of $foo. Yes. For example: my $foo is persistent; > Basically, an rvalued: > > $foo : bar > > becomes a syntactically and cognitively cheap way, and > a cognitively very different way, of calling bar on $foo, a > cheapness and difference that amplifies if one applies > several of these: > > $foo : bar baz qux > > instead of > > qux(baz(bar($foo))) Err. No. That would be: bar(1); baz(1); qux(1); or possibly: $_=\$foo; bar(1); baz(1); qux(1); > I realize this isn't particularly appealing, but bare with me ;-) > a little longer. > > So, in: > > $foo : bar > > bar in this context is not a property, but instead a more > general "post" or similar (alluding to the notion that it is > a bit like a postfix sub as well as (possibly) having the > sticky note aspect.) No. There will, I hope, be a mechanism for pre- and postfixing subroutines, but not properties I think. > So, to recap: > > $foo : bar; > > means bar is posted to $foo. $foo's value may change > or stay the same. The return value may be $foo's, either > before or after posting, or some other value. $foo's value > may now have an attached bar postit. You lost me here. Your ideas for properties are different from mine (which may well, in turn, be different from Larry's). Damian