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

C# and Rust modules have different server-side reducer names #2165

Open
kazimuth opened this issue Jan 23, 2025 · 1 comment
Open

C# and Rust modules have different server-side reducer names #2165

kazimuth opened this issue Jan 23, 2025 · 1 comment
Assignees

Comments

@kazimuth
Copy link
Contributor

kazimuth commented Jan 23, 2025

Noticed this while playing with Blackholio.

Swapping between the C# and Rust versions of the modules, the generated code is ALMOST identical. In the C# client code, the user can always call reducers like .EnterGame() and have it work.

The difference is that, if the C# version of the module is used, under the hood, .EnterGame() sends a message containing the string "EnterGame". On the other hand, if the Rust version of the module is used, under the hood, .EnterGame() send a message containing the string "enter_game". This means that the user needs to regenerate client code when swapping between the modules, despite there not being any user-facing API changes.

If we want to fix this, we could canonicalize reducer names in a module to either a snake_case or a CamelCase convention.

@kazimuth kazimuth self-assigned this Jan 23, 2025
@RReverser
Copy link
Member

Swapping between the C# and Rust versions of the modules, the generated code is ALMOST identical. In the C# client code, the user can always call reducers like .EnterGame() and have it work.

FWIW you could just rename C# methods to match Rust ones - that's what we do for ModuleDef equivalence comparisons between C#/Rust modules in tests.

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