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

Why does collect() silently ignore unexpected positional args? #545

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

timsnyder
Copy link
Contributor

Opening a PR for this because it is the easiest way to see if the added test still fails with latest sparta without creating an updated env locally.

I would expect that pevent.collect() should throw if called positional arguments that are:

  • unexpected (i.e. the pevent wasn't defined to take any positional args)
  • mismatching type (as it looks like compilation doesn't catch this) - didn't commit the test I added for this in this commit
  • what other sanity checking is feasible?

The test added in this PR shows that we can call collect() with positional args for events that haven't registered any positional args. Why?

As it is, code in the wild has become quite confusing where positional args are being passed to collect() and silently ignored. I'm looking at how to propose improving this part of sparta but I wanted to start a discussion but first create a PR that will demonstrate that this behavior isn't considered a throwable conidtion in latest sparta.

Opening a PR for this because it is the easiest way to see if the added test still fails with latest sparta without creating an updated env locally.

I would expect that `pevent.collect()` should throw if called positional arguments that are:
* unexpected (i.e. the pevent wasn't defined to take any positional args)
* mismatching type (as it looks like compilation doesn't catch this) - didn't commit the test I added for this in this commit
* what other sanity checking is feasible?

The test added in this PR shows that we can call `collect()` with positional args for events that haven't registered any positional args.  Why?

As it is, code in the wild has become quite confusing where positional args are being passed to `collect()` and silently ignored.  I'm looking at how to propose improving this part of sparta but I wanted to start a discussion but first create a PR that will demonstrate that this behavior isn't considered a throwable conidtion in latest sparta.
@timsnyder timsnyder added component: sparta Issue is related to sparta framework question Further information is requested labels Dec 3, 2024
@timsnyder timsnyder marked this pull request as draft December 3, 2024 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: sparta Issue is related to sparta framework question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant