>> What distinguishes it is that I was adding a new case to <| operator where
>> the LHS is a constructor function and the RHS is an object literal. My
>> intention was that SuperClass would be the constructor function not a
>> prototype. Perhaps this is confusing because the return type is not the same
>> as the same as the RHS.
>
> Ok, your intent didn't come across.
>
> What happens if the RHS does't have a 'constructor' property? For example:
> let obj = function() {} <| {};
>
> Would obj be a function object? If so, what is it's body. Is it the
> existence of a 'constructor' property in the LHS object literal that triggers
> the creation of a function object instead of a non-function?
I can see this work for a general case of
<function> <| { … }
As soon as the RHS is a function, the result is a function. Russell mentioned
that if the RHS didn’t have a property "constructor", its value would be
function() {} by default.
I see two problems:
- If you introduce a new mechanism, you might as well introduce class literals.
- You might really want to create an object whose prototype is a function.
--
Dr. Axel Rauschmayer
[email protected]
twitter.com/rauschma
Home: rauschma.de
Blog: 2ality.com
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss