The current abstraction is Action creates a Message, and the Message generates the dict to pass to the destination.
This adds a bunch of overhead (e.g. the Message has code to look up the current Action even when it was created by the Action!) and in general it's not clear that having a first-class Message abstraction is useful. E.g. only Message.bind() makes having a class at all relevant, and it's not clear anyone uses that.
So:
Prototype and benchmark adding .log() method as an alternative (there would also be a standalone logging function similar to what Message.log does where it doesn't have to be in Action context, for use in e.g. logging bridges or other code where there isn't necessarily current action).
If it's faster, implement and deprecate Message class.
The current abstraction is Action creates a Message, and the Message generates the dict to pass to the destination.
This adds a bunch of overhead (e.g. the Message has code to look up the current Action even when it was created by the Action!) and in general it's not clear that having a first-class Message abstraction is useful. E.g. only
Message.bind()
makes having a class at all relevant, and it's not clear anyone uses that.So:
.log()
method as an alternative (there would also be a standalone logging function similar to whatMessage.log
does where it doesn't have to be in Action context, for use in e.g. logging bridges or other code where there isn't necessarily current action).Message
class.