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

Syntax lookup: add ref value assignment documentation #206

Merged

Conversation

illusionalsagacity
Copy link

@illusionalsagacity illusionalsagacity commented Jan 22, 2021

for #162

---

This operator is syntactic sugar for assigning to the `contents` value of a `ref`

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually no sugar provided for ref, both ref and := are functions in pervasives module

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, I was essentially quoting from pages/docs/manual/latest/mutation.mdx:

Assign a new value to `myValue` like so:

<CodeTab labels={["ReScript", "JS Output"]}>

\```res example
myValue.contents = 6
\```
\```js
myValue.contents = 6;
\```

</CodeTab>

We provide a syntax sugar for this:

<CodeTab labels={["ReScript", "JS Output"]}>

\```res example
myValue := 6
\```
\```js
myValue.contents = 6;
\```

</CodeTab>

Should I re-work this language as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some comments. I think it's not important how this is implemented, we should just describe what it does and how it is useful.

@illusionalsagacity illusionalsagacity marked this pull request as ready for review January 23, 2021 04:05
@illusionalsagacity illusionalsagacity changed the title [DRAFT] add ref assignment documentation Syntax lookup: add ref value assignment documentation Jan 23, 2021
@ryyppy
Copy link
Member

ryyppy commented Jan 25, 2021

@illusionalsagacity looking good, thanks!

@ryyppy ryyppy merged commit af37d4f into rescript-lang:master Jan 25, 2021
@illusionalsagacity illusionalsagacity deleted the docs-operator-ref-assignment branch January 25, 2021 18:03
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