dtolnay / watt

Runtime for executing procedural macros as WebAssembly
Apache License 2.0
1.29k stars 29 forks source link

Tweak README example to be clearer #39

Closed Arnavion closed 4 years ago

Arnavion commented 4 years ago

Both the crate and the macro in the original text were named "my_macro", so it was not obvious which one corresponded to what. This commit names them "foo-macros" and "bar".

Also, the original text talked about the "my_macros" crate and the shim crate, but the shim crate deserves to have the name the user gave to the original pre-watt crate, since that is what gets published to crates.io. The text now walks the user through renaming "foo-macros" to "foo-macros-impl" and naming the shim crate "foo-macros".

Arnavion commented 4 years ago

I would've liked the part about renaming the original crate to -impl to be left in.

dtolnay commented 4 years ago

It's not a necessary step. I would tend to give the shim the same name as suggested in the update. There shouldn't be steps in the readme that aren't needed.

Arnavion commented 4 years ago

It's fine to give this the same crate name as the previous crate, since the other one won't be getting published to crates.io. In a new Cargo.toml, put:

And where does the reader put this new "Cargo.toml" which is supposed to be for a crate with the same name "my_macros", when the directory for my_macros already has the original crate?

There are two parts to renaming. The directory and the crate name. It's fine if you don't want to rename the crate, but I would've liked to keep the part that mentions renaming the directory.

See for example the demo in this very repo: https://github.com/dtolnay/watt/tree/master/demo/impl