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

Define behavior for task/flow protocol violations #63

Open
leonoel opened this issue Apr 14, 2022 · 2 comments
Open

Define behavior for task/flow protocol violations #63

leonoel opened this issue Apr 14, 2022 · 2 comments

Comments

@leonoel
Copy link
Owner

leonoel commented Apr 14, 2022

Currently the operator implementation expects tasks and flows to be compliant with the specification, otherwise the behavior is undefined.

This happens in the following situations :

  • programmer mistakes, e.g an operator receives a non-flow where it should be a flow. Not supposed to happen in production but very common during dev time, good reporting could improve user experience.
  • abnormal conditions such as OutOfMemoryError thrown by a callback. Not supposed to happen in production either, but if/when it does the program should do its best to propagate and report the error.
@mjmeintjes
Copy link

This would be a major improvement, as currently these types of bugs are very difficult to diagnose and prevent.

Some things to think about:

  • throw an exception as soon as I try to m/? something that is not a task
  • whether to allow (m/? nil) - it would simplify things if that just returned nil, but I'm not sure about the implications of that
  • allow some way of printing warnings when running m/? outside a process block

@mjmeintjes
Copy link

Here's an example of invalid behavior:

These throw exceptions as expected:

  (m/? (m/seed [1 2]))

  (m/? (m/ap))

  (m/? (m/ap (m/?> (m/seed [1 2]))))

I would expect the following to throw an exception, but it just hangs instead. This can be difficult to diagnose when happens deep inside a process.

(m/? (m/ap (m/?= (m/seed [1 2]))))

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

No branches or pull requests

2 participants