It can still be made to work...

```js
const Abc = (function() {
    const cache = new Map;
    function readCache(c, arg, val=new Map) {
        if (!c.has(a))
            c.set(a, val);

        return c.get(arg);
    }
    return (a, b, c) => {
        // ...optionally do something with a, b, and c...
        // Return a class
        let retval = class Abc$ {
            constructor(x, y, z) {
                this.x = x;
                this.y = y;
                this.z = z;
            }

            // ...optionally do something with a, b, and c...
            show() {
                console.log(`a = ${a}, b = ${b}, c = ${c}`);
                console.log(`x = ${this.x}, y = ${this.y}, z = ${this.z}`);
            }
        };

        return readCache(readCache(readCache(cache, a), b), c, retval);
    };
})();
const obj = new (Abc(4, 5, 6))(1, 2, 3);
obj.show();
```

Now `Abc(4, 5, 6) === Abc(4, 5, 6)`.

On Thu, Jan 17, 2019 at 10:25 AM ViliusCreator <viliuskubilius...@gmail.com>
wrote:

> But then `Abc(4, 5, 6) !== Abc(4, 5, 6)`. Using `Abc.constructor = class
> Abc$ {}` and then returning `Abc.constructor` won’t make it work.
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
>  Virus-free.
> www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
> <#m_7417576083780660614_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to