Owner, even if implemented which is not that easy as that would mean that foo.func !== bar.func (unless some other tricks are employed) would only benefit embedding API. bind, on the other hand, is 100% JS solution which would work in any JS engine in the world (well, let's hope it will).
So I personally don't see any benefits in Owner approach. YMMV of course. yours, anton. On Wed, May 12, 2010 at 5:55 PM, Seiji Sam Lee <[email protected]> wrote: > Yes, named bind, ok, but ... > > Do you think that Owner() technique would superimpose to named bind? Or that > two could coexist? > > > -----Mensaje original----- > De: [email protected] [mailto:[email protected]] En nombre > de Anton Muhin > Enviado el: miércoles, 12 de mayo de 2010 15:41 > Para: [email protected] > Asunto: Re: [v8-users] a simple question about > "args.This()->GetPointerFromInternalField" > > Again from right address, sorry. > > On Wed, May 12, 2010 at 5:39 PM, Anton Muhin <[email protected]> wrote: >> That is what is usually named bind (for example, >> http://www.prototypejs.org/api/function/bind) >> >> So I don't think any JS engine (including V8) would have direct >> support for this. But that's only my thoughts. >> >> yours, >> anton. >> >> On Wed, May 12, 2010 at 5:28 PM, Seiji Sam Lee <[email protected]> > wrote: >>> Thanks, Stephan and Anton, all yours solutions works fine, but not as I >>> expected!! >>> >>> Yes, Holder() is the right way, and two functions are right too! >>> >>> But I want to suggest a new property (like "Holder" or "This") called >>> "Owner", a reference to the object that own (in origin) the property. >>> >>> It could allow things like that: >>> >>> var echo=$out.puts >>> echo("Hello!!"); >>> >>> It simplify the creation of "delegates properties", in turn of put a >>> InternalField for each property. The scope of the delegated property is > the >>> same of its owner. >>> >>> Do you thing that this suggest is possible? >>> >>> >>> -----Mensaje original----- >>> De: [email protected] [mailto:[email protected]] En > nombre >>> de Stephan Beal >>> Enviado el: martes, 11 de mayo de 2010 20:54 >>> Para: [email protected] >>> Asunto: Re: [v8-users] a simple question about >>> "args.This()->GetPointerFromInternalField" >>> >>> On Tue, May 11, 2010 at 8:34 PM, Seiji Sam Lee <[email protected]> >>> wrote: >>>> var echo=$out.puts; >>> ... >>>> Are there any way to allow that code like that works fine? That is, > "echo" >>>> call catch correct "FILE*" parameter of "$out"? >>> >>> Something like: >>> >>> var echo = function() { >>> $out.puts.apply( $out, Array.prototype.slice.apply( arguments,[0]) ); >>> }; >>> >>> >>> -- >>> ----- stephan beal >>> http://wanderinghorse.net/home/stephan/ >>> >>> -- >>> v8-users mailing list >>> [email protected] >>> http://groups.google.com/group/v8-users >>> >>> -- >>> v8-users mailing list >>> [email protected] >>> http://groups.google.com/group/v8-users >>> >> > > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users > > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users > -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
