Reflect.type

Alexander Jones alex at weej.com
Fri Jun 5 21:47:25 UTC 2015


How might I find a champion for this? Any takers here?

On Tuesday, June 2, 2015, Alexander Jones <alex at weej.com> wrote:

> For some strange reason esdiscuss.org has garbled that link! For the
> benefit of those readers:
>
> https://github.com/alex-weej/es-reflect-type-proposal
>
> (Apologies for spam)
>
> On 2 June 2015 at 23:10, Alexander Jones <alex at weej.com
> <javascript:_e(%7B%7D,'cvml','alex at weej.com');>> wrote:
>
>> I've written this up as a strawman. It's available at
>> https://github.com/alex-weej/es-reflect-type-proposal
>>
>> Thanks
>>
>> On 15 May 2015 at 00:37, Alexander Jones <alex at weej.com
>> <javascript:_e(%7B%7D,'cvml','alex at weej.com');>> wrote:
>>
>>> I'm sure there will evolve some other nomenclature for that in due
>>> course. From http://www.slideshare.net/BrendanEich/value-objects2 it
>>> sounds as if it would be reasonable to define `Type(x)` to be `Value`, and
>>> thus `Reflect.type(x)` to be `Reflect.types.value`.
>>>
>>> Agree with the Symbol labels.
>>>
>>>
>>> On 14 May 2015 at 18:50, Andrea Giammarchi <andrea.giammarchi at gmail.com
>>> <javascript:_e(%7B%7D,'cvml','andrea.giammarchi at gmail.com');>> wrote:
>>>
>>>> FWIW, I think whatever contains "type" in modern JS should consider
>>>> `int32`, `float64`, and all TypedArrays plus it would be awesome to have a
>>>> way to define own types.
>>>>
>>>> In any case, if your idea will be implemented, I think it should have
>>>> named Symbols for debugging sake.
>>>>
>>>> ```js
>>>> Symbol('undefined'),
>>>> Symbol('null'),
>>>> Symbol('boolean')
>>>> ```
>>>>
>>>> This would be at least consistent with current implementations of
>>>> `Symbol.iterator` and friends.
>>>>
>>>> Best Regards
>>>>
>>>>
>>>>
>>>>
>>>> On Thu, May 14, 2015 at 5:29 PM, Alexander Jones <alex at weej.com
>>>> <javascript:_e(%7B%7D,'cvml','alex at weej.com');>> wrote:
>>>>
>>>>> Just an idea, if it doesn't already exist somewhere.
>>>>>
>>>>> Reflect.type(x) would match the spec's Type(x) function, in that it
>>>>> would basically be a better, more convenient typeof, i.e.
>>>>>
>>>>>     Reflect.types = {
>>>>>         undefined: Symbol(),
>>>>>         null: Symbol(),
>>>>>         boolean: Symbol(),
>>>>>         string: Symbol(),
>>>>>         symbol: Symbol(),
>>>>>         number: Symbol(),
>>>>>         object: Symbol(),
>>>>>     }
>>>>>
>>>>>     Reflect.type(null) === Reflect.types.null
>>>>>     Reflect.type(function() {}) === Reflect.types.object
>>>>>
>>>>> We weren't able to fix typeof null in harmony, but this seems like a
>>>>> good opportunity to introduce something new. Haven't thought about the
>>>>> repercussions of future support for new value types...
>>>>>
>>>>> Any thoughts?
>>>>>
>>>>> _______________________________________________
>>>>> es-discuss mailing list
>>>>> es-discuss at mozilla.org
>>>>> <javascript:_e(%7B%7D,'cvml','es-discuss at mozilla.org');>
>>>>> https://mail.mozilla.org/listinfo/es-discuss
>>>>>
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150605/b4954a31/attachment.html>


More information about the es-discuss mailing list