Template literal(includes tagged template) is so strong feature.
It makes it possible to add elegant DSL for Library(or maybe framework)
which also can interact with js.([styled-component proofed this with their
api](https://www.styled-components.com/))
Why don't we use them to enhance ECMAScript's API?
If we allow using tagged template to constructors just like this:
```js
new Constructor`
blahlah
`; // what about to call this syntax as tagged constructor?
```
we can do something like this:
#### If `Function` construcor is taggable
```js
const sum = new Function`
(a, b) {
return a + b;
}
`;
```
#### If `Map` constructor is taggable
```js
new Map`
a: 1234,
one: ${() => 1},
str: 'Hello!',
bool: true
`;
```
#### If `Set` constructor is taggable. and It supports list comprehension
```js
new Set`
${range}
-> ${x => x * 2}
-> ${x => x < 10}
`; // Set [2, 4, 6, 8]
```
Feedback is welcome!
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss