Thanks for the example. As I mentioned before, I prefer not using
JavaScript's getter and setter API. And by saying prefixing, I meant
creating two different functions to access a private variable like
getFoo and setFoo.

On Tue, Oct 30, 2012 at 12:12 PM, Rick Waldron <[email protected]> wrote:
>
>
> On Tue, Oct 30, 2012 at 2:40 PM, Azer Koçulu <[email protected]> wrote:
>>
>> On Tue, Oct 30, 2012 at 11:36 AM, Rick Waldron <[email protected]>
>> wrote:
>> >
>> > A little misleading, because what you're illustrating is actually just
>> > "a
>> > function". JavaScript accessors are created by defining get/set property
>> > descriptors or named get/set accessors.
>>
>> That's why ak47 exists! It introduces a new way of defining
>> properties. I don't think prefixing accessors as get/set is essential
>> to fill the definition of "accessor" in a dynamic language.
>
>
> I never said anything about prefixing... Prefixing is also not really an
> "accessor".
>
> Actual accessors: https://gist.github.com/eda4398feb774be889b1
>
> Rick
>
>
>
>
>
>>
>>
>> >
>> > Rick
>> >
>> >
>> >>
>> >>
>> >> On Tue, Oct 30, 2012 at 11:04 AM, Rick Waldron <[email protected]>
>> >> wrote:
>> >> >
>> >> >
>> >> > On Tue, Oct 30, 2012 at 1:37 PM, Azer Koçulu <[email protected]>
>> >> > wrote:
>> >> >>
>> >> >> It was non-optimized. After reading your response, I spent couple of
>> >> >> hours on optimizing it. Here are the numbers:
>> >> >
>> >> >
>> >> > Just a heads up... The "thing" you're calling "accessors" are not
>> >> > actually
>> >> > accessors.
>> >> >
>> >> >
>> >> > Rick
>> >> >
>> >> >
>> >> >>
>> >> >>
>> >> >> Before optimization:
>> >> >>
>> >> >> ak47-accessors: 7495ms
>> >> >> ak47-sub: 6963ms
>> >> >> ak47-subAll: 7785ms
>> >> >> ak47-pubsub: 6780ms
>> >> >>
>> >> >> After optimization (v0.0.5)
>> >> >>
>> >> >> ak47-accessors: 851ms
>> >> >> ak47-sub: 873ms
>> >> >> ak47-subAll: 1277ms
>> >> >> ak47-pubsub: 1868ms
>> >> >>
>> >> >> And here how I measure it:
>> >> >> https://github.com/azer/ak47/blob/master/benchmarks/index.js
>> >> >>
>> >> >> On Mon, Oct 29, 2012 at 7:43 PM, Jake Verbaten <[email protected]>
>> >> >> wrote:
>> >> >> > Is that the original non-optimized prototype or more optimized
>> >> >> > iteration
>> >> >> > of
>> >> >> > it?
>> >> >> >
>> >> >> >
>> >> >> > On Mon, Oct 29, 2012 at 5:42 PM, Rick Waldron
>> >> >> > <[email protected]>
>> >> >> > wrote:
>> >> >> >>
>> >> >> >> Related... v8 just landed support for Object.observe()
>> >> >> >>
>> >> >> >> -Rick
>> >> >> >>
>> >> >> >> On Monday, October 29, 2012 at 8:11 PM, Azer Koçulu wrote:
>> >> >> >>
>> >> >> >> Hi All,
>> >> >> >>
>> >> >> >> I've created a new JS library for defining properties that can be
>> >> >> >> subscribed for updates and can interact with eachother.
>> >> >> >>
>> >> >> >> Check it here;
>> >> >> >>
>> >> >> >> https://github.com/azer/ak47
>> >> >> >>
>> >> >> >> Readme contains many examples. Here is another one:
>> >> >> >>
>> >> >> >> var user = ak47({ name: 'joe', 'birthdate': 21 });
>> >> >> >>
>> >> >> >> > user.name()
>> >> >> >> "joe"
>> >> >> >> > user.name.subscribe(console.log);
>> >> >> >> > user.name("mike")
>> >> >> >> "mike"
>> >> >> >> "mike" "joe"
>> >> >> >>
>> >> >> >> Defining a new property that observes another(s):
>> >> >> >>
>> >> >> >> > var greeting = ak47(joe.name, function(name){
>> >> >> >> return 'Hello ' + name;
>> >> >> >> });
>> >> >> >> > greeting()
>> >> >> >> "Hello mike"
>> >> >> >> > joe.name("joe")
>> >> >> >> > greeting()
>> >> >> >> "Hello joe"
>> >> >> >>
>> >> >> >> What do you think?
>> >> >> >>
>> >> >> >> Azer
>> >> >> >>
>> >> >> >> --
>> >> >> >> Job Board: http://jobs.nodejs.org/
>> >> >> >> Posting guidelines:
>> >> >> >>
>> >> >> >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> >> >> >> You received this message because you are subscribed to the
>> >> >> >> Google
>> >> >> >> Groups "nodejs" group.
>> >> >> >> To post to this group, send email to [email protected]
>> >> >> >> To unsubscribe from this group, send email to
>> >> >> >> [email protected]
>> >> >> >> For more options, visit this group at
>> >> >> >> http://groups.google.com/group/nodejs?hl=en?hl=en
>> >> >> >>
>> >> >> >>
>> >> >> >> --
>> >> >> >> Job Board: http://jobs.nodejs.org/
>> >> >> >> Posting guidelines:
>> >> >> >>
>> >> >> >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> >> >> >> You received this message because you are subscribed to the
>> >> >> >> Google
>> >> >> >> Groups "nodejs" group.
>> >> >> >> To post to this group, send email to [email protected]
>> >> >> >> To unsubscribe from this group, send email to
>> >> >> >> [email protected]
>> >> >> >> For more options, visit this group at
>> >> >> >> http://groups.google.com/group/nodejs?hl=en?hl=en
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > Job Board: http://jobs.nodejs.org/
>> >> >> > Posting guidelines:
>> >> >> >
>> >> >> > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> >> >> > You received this message because you are subscribed to the Google
>> >> >> > Groups "nodejs" group.
>> >> >> > To post to this group, send email to [email protected]
>> >> >> > To unsubscribe from this group, send email to
>> >> >> > [email protected]
>> >> >> > For more options, visit this group at
>> >> >> > http://groups.google.com/group/nodejs?hl=en?hl=en
>> >> >>
>> >> >> --
>> >> >> Job Board: http://jobs.nodejs.org/
>> >> >> Posting guidelines:
>> >> >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> >> >> You received this message because you are subscribed to the Google
>> >> >> Groups "nodejs" group.
>> >> >> To post to this group, send email to [email protected]
>> >> >> To unsubscribe from this group, send email to
>> >> >> [email protected]
>> >> >> For more options, visit this group at
>> >> >> http://groups.google.com/group/nodejs?hl=en?hl=en
>> >> >
>> >> >
>> >> > --
>> >> > Job Board: http://jobs.nodejs.org/
>> >> > Posting guidelines:
>> >> > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> >> > You received this message because you are subscribed to the Google
>> >> > Groups "nodejs" group.
>> >> > To post to this group, send email to [email protected]
>> >> > To unsubscribe from this group, send email to
>> >> > [email protected]
>> >> > For more options, visit this group at
>> >> > http://groups.google.com/group/nodejs?hl=en?hl=en
>> >>
>> >> --
>> >> Job Board: http://jobs.nodejs.org/
>> >> Posting guidelines:
>> >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> >> You received this message because you are subscribed to the Google
>> >> Groups "nodejs" group.
>> >> To post to this group, send email to [email protected]
>> >> To unsubscribe from this group, send email to
>> >> [email protected]
>> >> For more options, visit this group at
>> >> http://groups.google.com/group/nodejs?hl=en?hl=en
>> >
>> >
>> > --
>> > Job Board: http://jobs.nodejs.org/
>> > Posting guidelines:
>> > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> > You received this message because you are subscribed to the Google
>> > Groups "nodejs" group.
>> > To post to this group, send email to [email protected]
>> > To unsubscribe from this group, send email to
>> > [email protected]
>> > For more options, visit this group at
>> > http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>> --
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines:
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to