Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Direct mutation of outputs in methods #33

Closed
thejohnfreeman opened this issue Jun 21, 2012 · 3 comments
Closed

Direct mutation of outputs in methods #33

thejohnfreeman opened this issue Jun 21, 2012 · 3 comments

Comments

@thejohnfreeman
Copy link
Member

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.

@gfoust
Copy link
Member

gfoust commented Jun 21, 2012

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.

@thejohnfreeman
Copy link
Member Author

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).

@thejohnfreeman
Copy link
Member Author

My patch is incomplete. Do not use direct mutation of outputs yet.

thejohnfreeman added a commit to thejohnfreeman/hotdrink that referenced this issue Jun 25, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants