Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-27 Thread Dmitry Soshnikov
(sorry, was in a small vacation, can't answer earlier) Yes, I'm perfectly aware about what host objects may do (there is even wide-spread phrase in JS community: do not trust to host objects, they can do almost anything). From this viewpoint, if to treat these proxies as host objects, then in

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-21 Thread Andrea Giammarchi
This is almost the exact behavior I was talking about ... Object.withNoSuchMethod = function withNoSuchMethod(obj, __noSuchMethod__) { var cachedInvokes = {}; return Proxy.create({ get: function (receiver, name) { return name in obj ? obj[name] :

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-21 Thread Dmitry Soshnikov
On 20.12.2011 17:00, Tom Van Cutsem wrote: - @Tom: Found bugs in DirectProxies.js Thanks for reporting, but I don't think these are bugs: 1. Properties created via assignment gets `false' value for descriptor attributes; should be true. E.g. foo.bar = 10, where `foo' is

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-21 Thread Dmitry Soshnikov
Funny implementation :P You did it vice-versa: functional objects _do_ work, but simple calls do not :D No, not good to depend on `this' value and non-Reference type. Dmitry. On 21.12.2011 16:05, Andrea Giammarchi wrote: This is almost the exact behavior I was talking about ...

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-21 Thread Tom Van Cutsem
2011/12/21 Dmitry Soshnikov dmitry.soshni...@gmail.com On 20.12.2011 17:00, Tom Van Cutsem wrote: You can (and probably should) advertise a virtual method as configurable:true. I can only `configurable: true', but as we said, to fix broken `delete' operator, we need to treat these

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-20 Thread Tom Van Cutsem
- @Tom: Found bugs in DirectProxies.js Thanks for reporting, but I don't think these are bugs: 1. Properties created via assignment gets `false' value for descriptor attributes; should be true. E.g. foo.bar = 10, where `foo' is direct proxy, makes bar non-configurable I can't

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-18 Thread Dmitry Soshnikov
On 18.12.2011 2:51, Brendan Eich wrote: From: Dmitry Soshnikovdmitry.soshni...@gmail.com On 17.12.2011 17:21, Herby Vojčík wrote: Hello, from my point the scenario that: delete lib.toRussianName; then it still: typeof lib.toRussianName; // function, Trollface ;D is much more

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-17 Thread Dmitry Soshnikov
mailto:es-discuss@mozilla.org Sent: Friday, December 16, 2011 8:30:47 AM Subject: Re: noSuchMethod: funargs + invoke-only-phantoms you don't use apply randomly, you use apply for methods or getters knowing there is a function there. __noSuchMethod__ is about NOT HAVING

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-17 Thread Herby Vojčík
Hello, from my point the scenario that: delete lib.toRussianName; then it still: typeof lib.toRussianName; // function, Trollface ;D is much more acceptable (it happens everyday - there are non-writable properties everywhere), than the scenario where I cannot transform

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-17 Thread Andrea Giammarchi
Dmitry, addressing a trap fallback is not a good idea plus the average JS coder rarely does it ... said that, the moment you are using a method you already know this exists so you already know the documentation ( or part of it ) so I don't see much hurt there. Moreover, the addressing problem is

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-17 Thread Andrea Giammarchi
and about last point, maybe objects that implements noSuchMethod should return something like unknown via typeof ... just saying, and simply to differentiate these objects from others where __noSuchMethod__ is not in place. On Sat, Dec 17, 2011 at 3:08 PM, Andrea Giammarchi

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-17 Thread Dmitry Soshnikov
On 17.12.2011 17:21, Herby Vojčík wrote: Hello, from my point the scenario that: delete lib.toRussianName; then it still: typeof lib.toRussianName; // function, Trollface ;D is much more acceptable (it happens everyday - there are non-writable properties everywhere), Yes, good

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-17 Thread Dmitry Soshnikov
On 17.12.2011 18:08, Andrea Giammarchi wrote: Dmitry, addressing a trap fallback is not a good idea plus the average JS coder rarely does it ... said that, the moment you are using a method you already know this exists so you already know the documentation ( or part of it ) so I don't see much

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-17 Thread Herby Vojčík
That's why I proposed first-class phantoms in gist: beasts that typeof to phantom, ToBoolean to false, ToNumber to 0, are wrapping a function, [[Call]] calls that function, [[Get]] and [[Prototype]] delegates to that function ([[Class]] is questionable) and rest does not work ([[Set]]

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-17 Thread Brendan Eich
From: Dmitry Soshnikov dmitry.soshni...@gmail.com On 17.12.2011 17:21, Herby Vojčík wrote: Hello, from my point the scenario that: delete lib.toRussianName; then it still: typeof lib.toRussianName; // function, Trollface ;D is much more acceptable (it happens

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-16 Thread Dmitry Soshnikov
@mozilla.org Sent: Thursday, December 15, 2011 5:48:37 AM Subject: noSuchMethod: funargs + invoke-only-phantoms Hi, Here is the analysis of current noSuchMethod situation implemented via proxies. I summarized that never-ending thread from 2010 ( https://mail.mozilla.org/pipermail/es-discuss

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-16 Thread Andrea Giammarchi
, December 15, 2011 5:48:37 AM Subject: noSuchMethod: funargs + invoke-only-phantoms Hi, Here is the analysis of current noSuchMethod situation implemented via proxies. I summarized that never-ending thread from 2010 ( https://mail.mozilla.org/pipermail/es-discuss/2010-October/011929.html

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-16 Thread Andrea Giammarchi
: noSuchMethod: funargs + invoke-only-phantoms Hi, Here is the analysis of current noSuchMethod situation implemented via proxies. I summarized that never-ending thread from 2010 ( https://mail.mozilla.org/pipermail/es-discuss/2010-October/011929.html), since guys in JS community started to ask why

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-16 Thread Brendan Eich
, December 16, 2011 8:30:47 AM Subject: Re: noSuchMethod: funargs + invoke-only-phantoms you don't use apply randomly, you use apply for methods or getters knowing there is a function there. __noSuchMethod__ is about NOT HAVING A FUNCTION there and if the property is not defined apply should

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-16 Thread Andrea Giammarchi
- From: Andrea Giammarchi andrea.giammar...@gmail.com To: Dmitry Soshnikov dmitry.soshni...@gmail.com Cc: Brendan Eich bren...@mozilla.com, es-discuss es-discuss@mozilla.org Sent: Friday, December 16, 2011 8:30:47 AM Subject: Re: noSuchMethod: funargs + invoke-only-phantoms you don't