Skip to content

Latest commit

 

History

History
70 lines (48 loc) · 2.17 KB

1000-make-array-built-in.md

File metadata and controls

70 lines (48 loc) · 2.17 KB
stage start-date release-date release-versions teams prs project-link suite
accepted
2023-12-22 00:00:00 UTC
framework
learning
typescript
accepted

Make (array) a built in helper

Summary

Today, when using gjs/gts/<template>, in order make arrays in templates, folks must import the (array) helper. Because creating arrays is fairly commonplace, this is an annoyance for developers, in part, due to how almost every other language has array literal syntax.

This RFC proposes that (array) 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 array from @ember/helper will still work due to how values defined locally in scope override globals.

The behavior of array 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 element in the array is individually reactive.

How we teach this

Once implemented, the guides, if they say anything about gjs/gts/<template> and array 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 array is defined.

  • counterpoint: do they need to?

Alternatives

n/a

Unresolved questions

n/a