Skip to content

Conversation

@seberg
Copy link
Contributor

@seberg seberg commented Nov 7, 2025

This is exploring a pattern for a stateful class. An alternative idea would be to actually dispatch on a "state" object every time (making the dispatching a real multiple dispatching, I guess).

This is conceptually:

  • When a given method is called dispatch once to find the implementation.
  • After this, on any method/property use, forward to the implementation. (This includes the initial method call itself.)

The once dipatching is a normal dispatching function, just a different decorator because the default is to do nothing (and not to call the function).

This is exploring a pattern for a stateful class.  An alternative idea
would be to actually dispatch on a "state" object every time (making
the dispatching a real multiple dispatching, I guess).

This is conceptually:
* When a given method is called dispatch once to find the implementation.
* After this, on any method/property use, forward to the implementation.
  (This includes the initial method call itself.)

The once dipatching is a normal dispatching function, just a different
decorator because the default is to do nothing (and not to call the
function).
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 this pull request may close these issues.

1 participant