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

spot() vs act API #27

Open
robiness opened this issue Oct 20, 2023 · 2 comments
Open

spot() vs act API #27

robiness opened this issue Oct 20, 2023 · 2 comments

Comments

@robiness
Copy link
Collaborator

Not reading any documentation of course and just wanting to kickstart using spot it feels counter intuitive to have spot(), creating an instance of spot and an act, which does not have an constructor.
Does it make sense to you to make act() also valid?

I also would love to have an act() method on selectors so this would be interchangeable:
await act.tap(spotSingle<ElevatedButton>());
await spotSingle<ElevatedButton>().tap();

Where the latter makes it way more discoverable and , for me at least, more intuitive.

This has probably already been thought of and the act API is about to , since overall the API feels nice and smooth.

@passsy
Copy link
Owner

passsy commented Oct 20, 2023

Fair request, I thought long about this.

I have the feeling that a .tap() would lead to many mistakes because it returns a Future and has to be awaited. You would most likely miss it every time you use it, right?

@passsy
Copy link
Owner

passsy commented Dec 25, 2023

Counter argument: "Code is read much more often than it is written, so plan accordingly" src. Thus we should design for readability.

One might argue that a chained tap() might be easier to write.

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