Skip to content

Add some docs to stblib Symbol #7336

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 9 commits into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
check
  • Loading branch information
jderochervlk committed Mar 14, 2025
commit 032632186644b71ca55aa26849c796cda60f6076
2 changes: 1 addition & 1 deletion runtime/Stdlib_Symbol.res
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
type t

@val external make: string => t = "Symbol"
@val external getFor: string => t = "Symbol.for"
@val external getFor: string => option<t> = "Symbol.for"
@val external keyFor: t => option<string> = "Symbol.keyFor"
@get
external description: t => option<string> = "description"
Expand Down
8 changes: 3 additions & 5 deletions runtime/Stdlib_Symbol.resi
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Otherwise a new Symbol gets created and registered with key.
## Examples

```rescript
Symbol.getFor("foo")->assetEqual("foo")
Symbol.getFor("sym1")->assetEqual(Symbol.getFor("sym1"))
Copy link
Member

Choose a reason for hiding this comment

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

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

```
*/
@val
Expand All @@ -48,13 +48,11 @@ Retrieves a shared Symbol key from the global Symbol registry for the given Symb
```rescript
let globalSym = Symbol.getFor("sym1") // Global symbol

Console.log(Symbol.keyFor(globalSym))
// Expected output: "sym1"
Symbol.keyFor(globalSym)->assertEqual(Some("sym1"))

let localSym = Symbol.make("sym2") // Local symbol

Console.log(Symbol.keyFor(localSym))
// Expected output: undefined
Symbol.keyFor(localSym)->assertEqual(None)
```
*/
@val
Expand Down