Proposal static type constraints features

Jordan Harband ljharb at gmail.com
Mon Jun 4 05:08:36 UTC 2018


`function f(x = void String) { return typeof x !== 'string' || typeof x ===
'undefined'; } assert(f(3))` is code that might stop working properly if
`void String` changes from being `undefined` to literally anything else.

2018-06-03 22:01 GMT-07:00 YU HengChun <achun.shx at qq.com>:

> Strictly speaking, the behavior is different.
>
> However, can you provide me with a real, conflicting example?
>
> Or you give me an example, I write a version of the proposal, you can test
> whether it is really harmful.
>
>
> If it is finally proved that the semantics are different, but it is indeed
> harmless, it is normal to add new semantics.
>
> In fact ECMAScript has been enriching semantics.
>
> 严格意义上讲, 这个提案的确产生了不同的语义行为.
>
> 但是, 你能举一个真实的例子来说明这个提案会产生为哈么?
>
> 或者, 你给我一个例子, 我用提案的写法写一个版本, 你可以测试下是否真的有危害.
>
> 如果最终证明虽然语义不同, 但的确是无危害性的, 那么添加新的语义是很正常的.
>
> 事实上 ECMAScript 就是在不断的丰富语义啊.
>
> _______________________________________________
> es-discuss mailing list
> 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/20180603/84ede5ad/attachment.html>


More information about the es-discuss mailing list