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

AddListener and AddLIstenerDispatch #20

Open
cnewman opened this issue Aug 29, 2017 · 2 comments
Open

AddListener and AddLIstenerDispatch #20

cnewman opened this issue Aug 29, 2017 · 2 comments

Comments

@cnewman
Copy link
Member

cnewman commented Aug 29, 2017

AddListener and AddListenerDispatch are always called together.

If you call AddListener alone, you only add this to a policy that isn't connected tot he dispatcher (and will never run)

If you call AddListenerDispatch alone, you aren't listening to the policy (even though the dispatcher is calling it) so you get no information.

I can't think of any reason why you'd call them alone.

Because of this, there should be a function or something that calls both just for ease of use for anyone learning how to use the dispatcher. EVEN if there is a reason to call one or the other separately, there should still be a function that does both, imo.

@mjdecker
Copy link
Contributor

mjdecker commented Sep 27, 2017

They are time oriented. The Dispatch/NoDispatch are used for while the dispatcher is running. AddListener is for before dispatcher starts. AddListener is called by AddListenerDispatch.

Not sure need to add before running, as you can just use the constructor, I would say we maybe make AddListener/RemoveListener protected.

@cnewman
Copy link
Member Author

cnewman commented Sep 28, 2017

The point is that, from an outside viewer (someone unfamiliar), it's probably incredibly confusing (when do you call add, which one to call, what do you call add on and why?). Convenience functionality would likely lower learning curve. Or a very good explanation of the API somewhere.

I did get one thing wrong in the issue. When you aren't listening to another policy, only calling one makes sense. But when you are dealing with more than 1 policy, you have to deal with at least two add calls somewhere.

You can only use the template ctor if you're not going to customize using the policy ctor. Unless you're talking about something else, I can't tell.

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