"Michael Lazzaro" <[EMAIL PROTECTED]> wrote > I'm trying to think of a counterexample, in which you have a context > that _cannot_ be represented as a "type" according to this very broad > definition. I don't think it should be possible, is it? If it _is_ > possible, does that represent a flaw/limitation of the perl6 "types"?
Let us imagine that an object can tell us that it will be destroyed as a result of the assignment (we don't have ref-counts, but some variables are scoped lexically). Now imagine that the output object is expensive to create: but that the current object (which will be destroyed as a result of the assignment) can be cheaply modified. There might be some optimization potential here. Perhaps an example will clarify my thoughts my $big_heavy_object = Foo.new; $big_heavy_object = add($big_heavy_object, $bar); If the context provides access to the lvalue, then it may be possible to optimize. Effectively, we have the information to create an implicit C<+=> operator. The add method should be able to utilize the fact that it can recycle the old lvalue. If the old-lvalue is available in the context, then the context is more than a type. Dave.