jshistory-cn icon indicating copy to clipboard operation
jshistory-cn copied to clipboard

关于 Membranes 的翻译

Open qiulang opened this issue 3 years ago • 0 comments

Membranes 是ES6比较隐晦概念,个人感觉到现在也没几个人懂。我也一直没搞懂。中文文献里我也没看过对它的翻译,把它翻译成 隔离层 是不是妥当我不知道,但最好增加下说明。

比如这段 Proxies and WeakMaps were designed, and initially motivated, to support the creation of membranes. Proxies used standalone cannot be transparent, and cannot reasonably approximate transparency. Membranes come reasonably close to transparently emulating a realm boundary. For classes with private members, the emulation is essentially perfect. 本身就比较难懂晦涩了 ,翻译它就难上难。

Proxy 和 WeakMap 的最初设计动机,是支持隔离层的创建。单独使用的 proxy 不可能是透明的,也不能合理地达到接近透明的程度。隔离层能合理且几乎透明地模拟 realm 的边界。对于具备私有成员的类而言,这种模拟基本上是完美的。

另 关于 Membranes 我自己看的比较好理解文档是这篇 What is a membrane?

This wrap-unwrap behavior is precisely what a membrane is.

qiulang avatar Jul 05 '21 07:07 qiulang