Re: GSJ GIRepository VS Seed
- From: Andrea Giammarchi <andrea giammarchi gmail com>
- To: Emmanuele Bassi <ebassi gmail com>
- Cc: Alan Knowles <alan roojs com>, javascript-list <javascript-list gnome org>
- Subject: Re: GSJ GIRepository VS Seed
- Date: Tue, 22 Mar 2016 12:25:23 +0000
>
You should not assume that, just because you're using a _javascript_> syntax, the underlying mechanisms are written with _javascript_ in mind.
fair enough, but to be more precise:
I'm assuming a type system exposed to JS would look and behave as JS as possible.
Regardless, if I know that `obj is-a Type` I expect `obj` to expose things available in `Type`
Why would a private runtime created object that would like to act `as-Type` not inherit or overload itself with `Type` features?
If I can read `Gio.File` interface and its methods, properties, etc, I'd expect any internal "class" should be able too.
I understand the cost of runtime analysis per each instance is an absolute no-go but would it be possible to lazily expose to JS the internal `GLocalFile` as prototype of GFile?
After all, all it takes to swap a prototype in JS is `Object.setPrototypeOf(GLocalFile.prototype, GFile.prototype)` where in GJS the polyfill for such ES6/2015 method is
```js
Object.setPrototypeOf = (set => (target, proto) => (set.call(target, proto), target))(
Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set
);
```
Having a *similar* prototype switch before exposing it to the outer Env would match normal/daily JS expectations where yet there are no interfaces or structs, just some sugar for classes and nothing else.
Best Regards
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]