Closed thejohnfreeman closed 12 years ago
If the method mutates the output directly, what would be the return value of the method? I'd like to suggest that it still return a value that is assigned to the output variable—or at least have the option of doing that. So if I indicate that I'm modifying the output variable, I could still return a completely different value for the output—not necessarily just a modified version of what's already there. That way it would be easier to write methods that may do one or the other.
I'm planning to let methods do one or the other, not both. If the method returns nothing or undefined (which are equivalent), then the outputs are checked for changes. If the method returns anything else, it is assigned to the output(s).
My patch is incomplete. Do not use direct mutation of outputs yet.
Methods should be able to return new values for outputs or mutate them directly. This feature should come with a change to the pubsub system to better support event drafts.