Skip to content

AddListener and AddLIstenerDispatch #20

Open

Description

@cnewman

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.

Activity

  1. mjdecker commented on Sep 27, 2017

    @mjdecker
    Contributor

    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.

  2. cnewman commented on Sep 28, 2017

    @cnewman
    MemberAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions