Yes, this is non standard, but it's supported by SpiderMonkey, and that's
what gjs uses.
It's an implementation detail anyway, and its purpose is to have callable
objects whose prototype is not Function.prototype, so that you can have
const MyClass = new Lang.Class(...);
and "MyClass instanceof Lang.Class" becomes true, even though MyClass is a
constructor (function).

In any case, this kind of question is better asked in a specific mailing
list, such as gnome-shell-list (most gjs devs are there) or
javascript-list. Alternatively, you can find us in IRC (#introspection,
#gnome-shell or #gnome-hackers).

Cheers,

Giovanni


2013/4/18 Nikita Churaev <[email protected]>

> I've stumbled upon this while reading lang.js:
>
> newClass.__proto__ = this.constructor.prototype;
>
> where newClass is a function. Why does Gjs do this? Isn't this
> non-standard?
>
> _______________________________________________
> desktop-devel-list mailing list
> [email protected]
> https://mail.gnome.org/mailman/listinfo/desktop-devel-list
>
_______________________________________________
desktop-devel-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/desktop-devel-list

Reply via email to