Skip to content

Consider reverting --reactor to --lib #198

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

Closed
vwkd opened this issue Nov 27, 2023 · 4 comments · Fixed by #211
Closed

Consider reverting --reactor to --lib #198

vwkd opened this issue Nov 27, 2023 · 4 comments · Fixed by #211

Comments

@vwkd
Copy link
Contributor

vwkd commented Nov 27, 2023

It seems as part of the large refactor in #101 the --lib flag was also renamed to --reactor. What's the reason for this change?

The term "reactor" suggests a component can somehow "react"? The term is commonly associated with reactive programming but it seems that's not what it should mean here.

The README admits the need to explain it means a library.

A reactor component [..] is meant to be used as a library.

It somewhat makes sense if calling the component's exported functions makes it "react". But in that sense, a command component similarly "reacts" to its run function being called.

Is there a strong reason to replace the existing term "library" that's widely used across languages and ecosystems with a new term "reactor" which might be confused with an unrelated meaning? Why not call a library a library?

@esoterra
Copy link
Collaborator

This distinction goes back to the idea of reactors vs commands going back to here or potentially earlier.

@peterhuene
Copy link
Member

In addition to aligning with component model terms, the intention behind the change was to make a distinction between a "normal" Rust lib package (one that compiles to an .rlib) that can be linked into any other package and a component "reactor" package (one that compiles to a .wasm) that cannot be statically linked by the Rust tooling.

However, cargo component new doesn't create lib packages and certainly reactor is perhaps needlessly introducing jargon that might be confusing to folks.

If there's general consensus that --lib makes sense, I'm happy to add it back as an alias to --reactor.

@tomasol
Copy link
Contributor

tomasol commented Jan 25, 2024

I am also in favor of the --lib switch, as it a more common term. When I see reactor I think of the reactive design pattern.

@pchickey
Copy link
Contributor

pchickey commented Jan 25, 2024

I forgot about this but seeing it bumped into my notifs now, and having sat with this for a little while I'm also in favor of changing it to --lib, because it is more familiar Rust terminology. Familiarity lowers the barrier for Rust developers to discover and use components, exposing them to less of the particularities and special terms as part of their initial journey is a good thing.

Understanding that a cargo component lib means component model reactor is something easy enough to learn later on if they become more sophisticated users, and using --lib doesnt shut us out of expressing anything else we currently anticipate this tool should do.

peterhuene added a commit to peterhuene/cargo-component that referenced this issue Jan 25, 2024
This commit renames the `--reactor` option for the `new` subcommand to `--lib`.

It maintains an alias of `--reactor` for backwards compatibility.

Updated the tests to use `--lib` and added a test to ensure `--reactor` is
still respected.

Closes bytecodealliance#198.
peterhuene added a commit that referenced this issue Jan 25, 2024
This commit renames the `--reactor` option for the `new` subcommand to `--lib`.

It maintains an alias of `--reactor` for backwards compatibility.

Updated the tests to use `--lib` and added a test to ensure `--reactor` is
still respected.

Closes #198.
skarmux added a commit to skarmux/component-docs that referenced this issue Jan 6, 2025
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 a pull request may close this issue.

5 participants