On Mon, Jul 11, 2005 at 11:48:09AM -0600, Luke Palmer wrote: : Then you don't need any special magic. But if you want to have : mutator methods that aren't in .= form (which I recommend against for : value types), maybe the `is value` trait makes the class do the : `value` role, which gives you a method, `value_clone` or something, : with which you specify that you're about to mutate this object, and : that Perl should do any copying it needs to now.
I think that's probably just "is cow", which is an autocloning variant of "is rw"/"is constant". (Though somebody's metaclass somewhere would have to take that class trait and apply it to any individual methods that return and/or mutate the object in question.) But basically, it's the same problem as wrapping a "constant" proxy, only the "cow" proxy clones when the "constant" proxy would pitch a fit. We specced an "is copy" on parameters at one point, but maybe that's just "is cow" too. Or maybe they should all be "is copy", and the COWness of it is just a lazy-style optimization that we should hide from the user. People who haven't read the manual will probably grok "is copy" better than "is cow" anyway, cute as it may be. So let's maybe go with "is copy". Or we go the other way and, in a binge of orthogonality, rationalize all the "on write" traits: Current Conjectural ======= =========== is constant is dow "die on write" is copy is cow "copy on write" is rw is mow "mutate on write" But thankfully Perl 6 is not intended to be a "perfect language". Larry