Skip to content

The example should output "Hello from Rust!" #1931

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

Merged
merged 2 commits into from
Jan 6, 2020

Conversation

fbitti
Copy link
Contributor

@fbitti fbitti commented Dec 28, 2019

Thanks for your examples, I'm learning a lot from them.
In this one in particular, the HTML says the user should see "Hello from Rust!" on the console, however it says "Hello, World!".
This is a proposed fix.

The HTML says the console would output Hello from Rust!, but instead it outputs Hello, World!
This is a proposed fix.
The HTML says the console would output "Hello from Rust!" but instead it outputs "Hello, World!".
This is a proposed fix.
@limira
Copy link
Contributor

limira commented Dec 30, 2019

My thought: Leave the example's message unchanged, or change it to:

Rust-wasm: Hello, JavaScript!

Where JavaScript is the value return by the function named name from JS.

@fbitti
Copy link
Contributor Author

fbitti commented Dec 30, 2019

My thought: Leave the example's message unchanged, ...

Some change is needed to match the guidance on HTML with the actual output on the JS console, in my humble opinion, this would reduce the level of frustration of a learner who is following the examples ("is the output different because this example is not doing what it says it would, or am I doing something wrong?").
Either change the HTML text or the console output or both.

@limira
Copy link
Contributor

limira commented Dec 30, 2019

Ha, sorry for misreading your original PR's message. I see the reason of this PR now. I never ran the example or read it carefully so I didn't know that the messages are mismatched.

This PR fixes the mismatch. It's turn out that the name Rust has to be retrieved from a JS's function and I think it's a bit weird. That's the reason of my comment.

Now, I think the message in index.html can be modified to:

Open up the developer console and you should see messages that output by Rust.

Because "Hello..." is not the only message output there. Again, sorry about the confusion!

@fbitti
Copy link
Contributor Author

fbitti commented Dec 30, 2019

Oh, by all means, thanks for your comments and attention. I will also make sure my future PRs have a clear explanation for the motivation.
As for your suggestion: I can revert the changes to the 2 configuration files and add this change to the HTML. Should I go ahead?

@limira
Copy link
Contributor

limira commented Dec 31, 2019

I am just a random contributor, not the one who make decisions in this project. I just voice my thought, you may do what I say if you agree with it. Otherwise, let's wait for response from the project's members.

@fbitti
Copy link
Contributor Author

fbitti commented Dec 31, 2019

Ok, I see... by all means your suggestions are welcome, but I will wait for the owner of this wasm-bindgen example to tell us the way forward.

@alexcrichton
Copy link
Contributor

Seems reasonable to me, I'm fine with tweaking this as necessary!

@alexcrichton alexcrichton merged commit aab99fe into rustwasm:master Jan 6, 2020
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 this pull request may close these issues.

3 participants