Re: Array.create and Function.create

2019-01-09 Thread Jordan Harband
An array with no prototype wouldn't have any of the iteration methods on it; a function with no prototype wouldn't have .call/.bind/.apply - length and name are own properties of functions, and length is an own property of an array, so you'd get those regardless. (`Array.from({ length: 1000 })`

Array.create and Function.create

2019-01-09 Thread Sultan
Identical to Object.create but for Arrays and Functions. This method will allow you to create arrays with no prototype. This would allow authors the ability to use array objects as state containers without the need to resort to index-based objects with Object.create(null, length) When you want

Re: How to prettify output of objects in the console, when using get/set, like browsers do?

2019-01-09 Thread Jordan Harband
`console` isn't part of the language; node and browsers have their own implementations (which is likely covered by an HTML spec), so you'd want to look into it there. node's `util.inspect`, for example, provides a `util.inspect.custom` symbol that's invoked to get a custom string version of the

How to prettify output of objects in the console, when using get/set, like browsers do?

2019-01-09 Thread #!/JoePea
Here's some nice output in the console in Chrome, for `DOMPoint` and `DOMPointReadOnly` classes: ```js const point = new DOMPoint(1,2,3,4) console.log(point) ``` output: ``` > DOMPoint {x: 1, y: 2, z: 3, w: 4} ``` ([codepen example](https://codepen.io/anon/pen/xmaVej), open the devtools

Re: Proposal: Add `NoSubstitutionTemplate` to `StringLiteral` Definition

2019-01-09 Thread Isiah Meadows
The first argument to each is an array of items. It's the same per lexical occurrence, but it's *not* the same across multiple lexical templates, even if they represent the same sequence of characters with interpolation expressions removed. That above expression is semantically more like this:

Re: Proposal: Add `NoSubstitutionTemplate` to `StringLiteral` Definition

2019-01-09 Thread Mark Miller
Template is transitively frozen, so it cannot be mutated in place. On Wed, Jan 9, 2019 at 11:49 AM T.J. Crowder < tj.crow...@farsightsoftware.com> wrote: > On Wed, Jan 9, 2019 at 7:40 PM Andrea Giammarchi > wrote: > > I dare saying tags are another issue here, 'cause "abc" === "abc", > > and

Re: Proposal: Add `NoSubstitutionTemplate` to `StringLiteral` Definition

2019-01-09 Thread T.J. Crowder
On Wed, Jan 9, 2019 at 7:40 PM Andrea Giammarchi wrote: > I dare saying tags are another issue here, 'cause "abc" === "abc", > and with an identity function such `const id = o => o`, > `id("abc") === id("abc")` but due latest changes to template > literals, id`abc` !== id`abc` so it's easily

Re: Proposal: Add `NoSubstitutionTemplate` to `StringLiteral` Definition

2019-01-09 Thread Andrea Giammarchi
I dare saying tags are another issue here, 'cause "abc" === "abc", and with an identity function such `const id = o => o`, `id("abc") === id("abc")` but due latest changes to template literals, id`abc` !== id`abc` so it's easily misleading in the tagged case. On Wed, Jan 9, 2019 at 7:53 PM Jordan

Re: Proposal: Add `NoSubstitutionTemplate` to `StringLiteral` Definition

2019-01-09 Thread Jordan Harband
import path specifiers are another. On Wed, Jan 9, 2019 at 10:16 AM T.J. Crowder < tj.crow...@farsightsoftware.com> wrote: > On Wed, Jan 9, 2019 at 5:36 PM FERREIRA, ERIC B > wrote: > > I contend that adding `NoSubstitutionTemplate`s to the definition of > > `StringLiteral` will bring the

Re: Proposal: Add `NoSubstitutionTemplate` to `StringLiteral` Definition

2019-01-09 Thread T.J. Crowder
On Wed, Jan 9, 2019 at 5:36 PM FERREIRA, ERIC B wrote: > I contend that adding `NoSubstitutionTemplate`s to the definition of > `StringLiteral` will bring the benefit of allowing teams to > completely opt to use only template strings instead of mixing quote > marks, while having very little risk

Proposal: Add `NoSubstitutionTemplate` to `StringLiteral` Definition

2019-01-09 Thread FERREIRA, ERIC B
Some teams opt to use exclusively template strings in their code (see template literals are strictly better strings for some reasoning). This is almost supported by ECMA, but for the fact that