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

Actor's output names collision with Object's instance methods #137

Closed
viralpraxis opened this issue Mar 2, 2024 · 2 comments · Fixed by #138
Closed

Actor's output names collision with Object's instance methods #137

viralpraxis opened this issue Mar 2, 2024 · 2 comments · Fixed by #138

Comments

@viralpraxis
Copy link
Contributor

class OutputWithBlacklistedName < Actor
  input :value, type: Integer

  output :object_id, type: Integer

  play -> actor { actor.object_id = actor.value.succ }
end

OutputWithBlacklistedName.call(value: 1).object_id != 2

Before #127 object_id would be correctly set (I doubt that overriding object_id is a good idea though).

One possible solution is to inherit Result from BasicObject and explicitly disallow output names that collide with Result.instance_methods

@viralpraxis
Copy link
Contributor Author

Inheriting from BasicObject might be a bit too much 🙂 I guess we can simply raise (on class loading) if someone defines input :object_id or similiar @sunny ?

@sunny
Copy link
Owner

sunny commented Mar 4, 2024

Yeah it would add a bit of safety to prevent things we think might be a dangerous name to override now (success, failure for example), fails for now (object_id for example), or that we know will cause chaos today (overriding call or any other internal method).

I’d be happy to accept a PR for that 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants