User:Colby Russell/JS bridge: Difference between revisions

From triplescripts.org wiki
Content added Content deleted
(JS support is optional, it must be statically declared, and actual use is discouraged)
($unported$ as suggested attribute to declare JS requirement)
Line 1: Line 1:
The official way to interface with JS shall be `Function`.
The official way to interface with JS shall be `Function`.


Runtimes will be permitted to provide optional support for JS. Apps/modules that need JS compatibility will need an attribute to statically declare their requirement.
Runtimes will be permitted to provide optional support for JS. Apps/modules that need JS compatibility will need an attribute to statically declare their requirement. (<code>[[$unported$]]: true</code>?)


You can ship a JS module (or module trees) by "compiling" the JS into a template literal, and then having a constructor that acts as a convenience wrapper around `Function`. However, this will be highly discouraged and is only made available as a stopgap so modules can eventually be ported to the triple script dialect.
You can ship a JS module (or module trees) by "compiling" the JS into a template literal, and then having a constructor that acts as a convenience wrapper around `Function`. However, this will be highly discouraged and is only made available as a stopgap so modules can eventually be ported to the triple script dialect.

Revision as of 03:08, 24 July 2020

The official way to interface with JS shall be `Function`.

Runtimes will be permitted to provide optional support for JS. Apps/modules that need JS compatibility will need an attribute to statically declare their requirement. ($unported$: true?)

You can ship a JS module (or module trees) by "compiling" the JS into a template literal, and then having a constructor that acts as a convenience wrapper around `Function`. However, this will be highly discouraged and is only made available as a stopgap so modules can eventually be ported to the triple script dialect.

IIFEs as an escape hatch are forbidden. (Only permitted in the shunting block and as a convenience for static assignments for legacy runtimes that don't support `class` and constant property additions to the prototype is too annoying.)

Cookies help us deliver our services. By using our services, you agree to our use of cookies.