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

Well _actually #112

Closed
energizah opened this issue Aug 2, 2019 · 3 comments
Closed

Well _actually #112

energizah opened this issue Aug 2, 2019 · 3 comments

Comments

@energizah
Copy link

Hey Glyph,

I'm a big fan of this library. I'm noticing that there's a certain pattern which makes me wonder about an API, and I'm curious to hear your thoughts.

The docs have an example like this:

connected.upon(send_message, enter=connected, [_actually_send_message])

which uses the _actually_send_message method. It reminds me a bit of marshmallow's pattern of field.serialize() calling field._serialize() and similar inheritance-oriented APIs. The common _actually_* naming convention makes me wonder if there should be a real namespace for these implementations

outputs=[mm.actually.send_message]

or mm.impl.send_mesage.

I'm interested if you've had this feeling or how you've dealt with the proliferation of _actually methods.

Cheers.

@glyph
Copy link
Owner

glyph commented Aug 5, 2019

I'm a big fan of this library.

Nice of you to say so!

@glyph
Copy link
Owner

glyph commented Aug 5, 2019

I'm interested if you've had this feeling or how you've dealt with the proliferation of _actually methods.

I've definitely felt it's a bit awkward to be cramming everything into the flat class namespace, when really only the input methods need to live there, and the outputs and states all want to be private.

I'm curious how you'd structure such an actually namespace - how do you get things into it? Keep in mind I don't want to confuse IDEs and type-checkers any more than automat already does.

@glyph
Copy link
Owner

glyph commented Aug 19, 2024

I think that #137 changes the structure so that it is much easier to avoid this sort of naming. There's still some level of duplication, you've got input protocol methods and you've got behavior implementation functions, but they can just be named the same thing now since they don't need to exist in the same namespace, so you don't need to mangle them with conventions like "_actually".

@glyph glyph closed this as completed Aug 19, 2024
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