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

API: Consider renaming interpret() to createService() #165

Closed
Zearin opened this issue Jun 20, 2021 · 8 comments
Closed

API: Consider renaming interpret() to createService() #165

Zearin opened this issue Jun 20, 2021 · 8 comments

Comments

@Zearin
Copy link
Contributor

Zearin commented Jun 20, 2021

The interpret() function returns something called a service everywhere else in the docs.

When I was first trying to learn Robot to use in a project of mine, it took me a couple of re-reads for this to sink in. That’s because the other functions return things that match the function name: createMachine() returns a machine, transition() returns a transition, state() returns a state, and so on.

(I don’t normally feel comfortable requesting a change to an API name. However, since Robot is still at version 0.2.x, I suppose this is the appropriate time (before v1.x) to do so.)

Consider renaming interpret() to createService(). This would make the function match what we call the thing it returns.

It would also make the only 2 top-level functions in Robot start with “create…”. That would be a nice cue that both functions are at that level.

@matthewp
Copy link
Owner

Personally I'd rather get rid of services altogether. I just haven't figured out how yet :)

@Zearin
Copy link
Contributor Author

Zearin commented Aug 22, 2021

Until you figure out how, can I do this rename in a Pull Request? :) (Including updating the docs!)

@Zearin
Copy link
Contributor Author

Zearin commented Dec 18, 2022

@matthewp ping :)

@Zearin
Copy link
Contributor Author

Zearin commented Jan 23, 2023

@matthewp QQ: Can you elaborate on your wish to drop services completely?

(i.e., are you talking about something like const fsm = createMachine({…}); fsm.run()?)

@ehuelsmann
Copy link
Collaborator

@Zearin see #106 for the line along @matthewp 's thinking.

@matthewp
Copy link
Owner

Yeah, thanks for calling that out @ehuelsmann. I don't think a rename accomplishes anything, so I'm going to close.

@Zearin
Copy link
Contributor Author

Zearin commented Dec 15, 2024

I was proposing a simple name-change (and docs update) to make robot easier to learn.

You are discussing (what sounds like) a major rewrite of a big part of the project.

I don't see why one had to block the other. But it's been years since I opened this.

Glad to see some activity picking up on the project again, though.

Whatever the rewrite turns out to be, I hope to check it out as soon as it lands! 👍

@matthewp
Copy link
Owner

I understand what you mean. But changing a name is a breaking change. If we haven't figured out services by the time 2.0 is released maybe we can consider it.

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

3 participants