On Thu, Dec 04, 2003 at 05:57:52PM -0700, Luke Palmer wrote: > Hodges, Paul writes: > > I'd *like* to be able to predeclare a trait or property to be distributed > > across any values placed in this array, but only this array. For example, it > > would be nice if I could have the default aspects of false and foo be > > applied to any Baz that gets stuck into @bar, but obviously this isn't the > > syntax to do it. I could make Baz's new() do it, but I don't want *ALL* Baz > > objects to be false and foo...just the ones in @bar. So, what I need is > > something more like > > > > my @bar of Baz; > > @bar.STORE.wrap { my $r = call; return $r >>but=<< (false,foo); } > > Something likely more like: > > my role property_wrap[Property [EMAIL PROTECTED] { > method STORE($newval) { SUPER::STORE($newval but [EMAIL PROTECTED]) } > } > @bar but= property_wrap[false, foo]; > > With emphasis on "something". (Extrapolating wildly the little bit I > know about roles and making up some semantics, such as C<but [EMAIL PROTECTED]>).
What's the difference between what you have above and this: my property property_wrap (Property [EMAIL PROTECTED]) { method STORE($newval) { SUPER::STORE($newval but [EMAIL PROTECTED]) } } @bar but= property_wrap(false, foo); ? The examples I remember from the As and Es all have round brackets around trait parameters (Hmm. And I can only remember is-trait examples too). Granted, the universe could have shifted under my feet without my knowledge. I discovered after reading this email that I've been assuming that square-bracket parameterization happened at compile-time while round-bracket parameterization was, of course, run-time. I don't know if that's even partially true though. If that isn't the distinction, then what is? Why the two bracket styles? -Scott -- Jonathan Scott Duff [EMAIL PROTECTED]