rescript-lang / rescript-lang/rescript-lang.org
Incorrect ReScript snippet and JS output in docs under "Design Decisions" block example
Nobody has claimed this yet.
- Dominant language
- MDX
- Stars
- 1.9k
- Forks
- 260
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 17
Description
Documentation link:
https://rescript-lang.org/docs/manual/latest/let-binding#design-decisions
Current ReScript snippet in doc:
if displayGreeting {
let message = "Enjoying the docs so far?"
Js.log(message)
}
respective JS output in doc:
if (displayGreeting) {
console.log("Enjoying the docs so far?");
}
When the starter project is cloned locally as described the ReScript snippet does not compile:
1 │ if displayGreeting {
2 │ let message = "Enjoying the docs so far?"
3 │ Js.log(message)
The value displayGreeting can't be found
FAILED: cannot make progress due to previous errors.
A similar result can also be observed in the playground linked from the ReScript snippet
When the ReScript snippet is fixed in the most obvious way the generated JS output does not match the documentation:
let displayGreeting = true
if displayGreeting {
let message = "Enjoying the docs so far?"
Js.log(message)
}
the actual JS generated output is (header and exports are omitted):
console.log("Enjoying the docs so far?");
var displayGreeting = true;
To get the if statement in JS output the ReScript snippet could be modified to:
let displayGreeting = ref(true)
if displayGreeting.contents {
let message = "Enjoying the docs so far?"
Js.log(message)
}
but the resulting JS output below still does not match the documention:
var displayGreeting = {
contents: true
};
if (displayGreeting.contents) {
console.log("Enjoying the docs so far?");
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Design Decisions block in the linked let-binding documentation, then reproduce the snippets in the linked starter project and ReScript playground. Determine a compiling example and verify its generated JavaScript output; done means both snippets and their relationship match the documented behavior.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100