See:
https://github.com/CreatorVilius/ecmascript-proposals/blob/master/proposal-class-templates.md
I think having Class Templates in JavaScript would be awesome thing and
should be implemented. But that’s just my opinion.
___
es-discuss mailing list
es
I could definitely see usage of this when using custom Constructors. But this
could confuse current code of JS:
```js
function A(B, C) {
if(typeof B === ‘string’) // ...
}
A({[Symbol.typeof]: ‘string’})
```
This would make new code to use not only `typeof B === ‘String’`, but also `B
instan
On Sat, Jan 12, 2019 at 8:19 AM Randy Buchholz
wrote:
> (Hi all, new to group)
>
>
>
> Some of the Well Known Symbols are linked to standard functions –
> Symbol.toStringTag - A string value used for the default description of an
> object. Used by Object.prototype.toString().
>
>
>
> When I have
`.constructor` is unreliable, and can be easily forged - of course,
`Symbol.typeof` would create the same unreliability with one of the few
truly reliable operators in the language.
On Tue, Jan 15, 2019 at 12:38 PM J Decker wrote:
>
>
> On Sat, Jan 12, 2019 at 8:19 AM Randy Buchholz
> wrote:
>
My thought was Symbol.typeof could improve both reliability and flexibility. It
could be abused, but no more than Symbol.toStringTag. My use case is putting
classes into “namespaces”. With [Symbol.typeof] =
“Collections.Lists.LinkedList”, I can get the qualified type of the object. I
can also u
Symbol.toStringTag can be used for this purpose now (and it already
unfortunately destroyed the reliability of
`Object.prototype.toString.call`).
On Tue, Jan 15, 2019 at 3:07 PM Randy Buchholz
wrote:
> My thought was Symbol.typeof could improve both reliability and
> flexibility. It could be abu
Right. Misappropriating a symbol corrupts its intent. As ES moves in a more
towards a more "class-ish" feel, and people start writing more classes, a
type/namespace system isn't far behind. Implementing some symbols to support
this helps drive some standard approaches and discourages symbol
mis
7 matches
Mail list logo