-
-
Notifications
You must be signed in to change notification settings - Fork 405
Make hash built-in in strict-mode #999
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
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6a9cb8f
Make hash built in
NullVoxPopuli ed57f36
write
NullVoxPopuli 63da119
Update text/0999-make-hash-built-in.md
NullVoxPopuli d891f33
Update text/0999-make-hash-built-in.md
NullVoxPopuli 076ba88
Update 0999-make-hash-built-in.md
NullVoxPopuli cf06b49
Update text/0999-make-hash-built-in.md
NullVoxPopuli 6839f1b
Merge branch 'master' into make-hash-built-in
achambers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| --- | ||
| stage: accepted | ||
| start-date: 2023-12-22T00:00:00.000Z | ||
| release-date: # In format YYYY-MM-DDT00:00:00.000Z | ||
| release-versions: | ||
| teams: # delete teams that aren't relevant | ||
| - framework | ||
| - learning | ||
| - typescript | ||
| prs: | ||
| accepted: https://github.com/emberjs/rfcs/pull/0999 | ||
| project-link: | ||
| suite: | ||
| --- | ||
|
|
||
| <!--- | ||
| Directions for above: | ||
|
|
||
| stage: Leave as is | ||
| start-date: Fill in with today's date, 2032-12-01T00:00:00.000Z | ||
| release-date: Leave as is | ||
| release-versions: Leave as is | ||
| teams: Include only the [team(s)](README.md#relevant-teams) for which this RFC applies | ||
| prs: | ||
| accepted: Fill this in with the URL for the Proposal RFC PR | ||
| project-link: Leave as is | ||
| suite: Leave as is | ||
| --> | ||
|
|
||
| # Make `(hash)` a built in helper | ||
|
|
||
| ## Summary | ||
|
|
||
| Today, when using gjs/gts/`<template>`, in order to make objects in a template, folks _must import_ the `(hash)` helper. | ||
| Because creating objects is fairly commonplace, this is an annoyance for developers, especially as almost every other language has object literal syntax. | ||
|
|
||
| This RFC proposes that `(hash)` be built in to `glimmer-vm` and not require importing. | ||
|
|
||
| ## Motivation | ||
|
|
||
| Arrays and Objects are not only very common to create, they are essential tools when yielding data out of components. | ||
|
|
||
| There is alternate motivation to implement _literals_ for arrays and objects, but that is a bigger can of worms for another time. | ||
|
|
||
| ## Detailed design | ||
|
|
||
| This change would affect strict-mode only. This is so that today's existing code that imports `hash` from `@ember/helper` will still work due to how values defined locally in scope override globals. | ||
|
|
||
| The behavior of `hash` would be the same as it is today, but defined by default in the `glimmer-vm`. | ||
|
|
||
| Being built in can give folks confidence that each property in the hash is individually reactive. | ||
|
|
||
| ## How we teach this | ||
|
|
||
| Once implemented, the guides, if they say anything about gjs/gts/`<template>` and `hash` by the time this would be implemented, would only remove the import. | ||
|
|
||
| The guides should also detail which functions are built in to the framework and, therefore, do not need to be imported. | ||
|
|
||
| ## Drawbacks | ||
|
|
||
| People may not know where `hash` is defined. | ||
| - counterpoint: do they need to? | ||
|
|
||
| ## Alternatives | ||
|
|
||
| n/a | ||
|
|
||
| ## Unresolved questions | ||
|
|
||
| n/a | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.