FAQ
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 nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Search Discussions

  • Rick Waldron at Oct 30, 2012 at 12:42 am
    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 (http://user.name)() "joe"
    user.name.subscribe(console.log);
    user.name (http://user.name)("mike")
    "mike"
    "mike" "joe"
    Defining a new property that observes another(s):
    var greeting = ak47(joe.name (http://joe.name), function(name){
    return 'Hello ' + name;
    });
    greeting()
    "Hello mike"
    joe.name (http://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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    For more options, visit this group at
    http://groups.google.com/group/nodejs?hl=en?hl=en
  • Jake Verbaten at Oct 30, 2012 at 2:43 am
    Is that the original non-optimized prototype or more optimized iteration of
    it?
    On Mon, Oct 29, 2012 at 5:42 PM, Rick Waldron 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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    For more options, visit this group at
    http://groups.google.com/group/nodejs?hl=en?hl=en
  • Vyacheslav Egorov at Oct 30, 2012 at 5:19 pm
    Implementation is still in progress. CLs that were landed introduce
    the skeleton of the system but there are no notifications coming in
    from the runtime yet.

    I don't know what the actual plan is but I would expect that
    implementation would degrade only performance of the observed objects
    not the system as whole like prototype did (similar to Object.freeze).

    --
    Vyacheslav Egorov

    On Tue, Oct 30, 2012 at 3:43 AM, Jake Verbaten 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 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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    For more options, visit this group at
    http://groups.google.com/group/nodejs?hl=en?hl=en
  • Rick Waldron at Oct 30, 2012 at 5:49 pm

    On Tue, Oct 30, 2012 at 12:19 PM, Vyacheslav Egorov wrote:

    Implementation is still in progress. CLs that were landed introduce
    the skeleton of the system but there are no notifications coming in
    from the runtime yet.

    I don't know what the actual plan is but I would expect that
    implementation would degrade only performance of the observed objects
    not the system as whole like prototype did (similar to Object.freeze).

    --
    Vyacheslav Egorov
    Thanks for filling in the blanks—I accidentally deleted Jake's response, so
    never saw until now

    Rick


    On Tue, Oct 30, 2012 at 3:43 AM, Jake Verbaten 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 <waldron.rick@gmail.com>
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    For more options, visit this group at
    http://groups.google.com/group/nodejs?hl=en?hl=en
  • Azer Koçulu at Oct 30, 2012 at 5:43 pm
    It was non-optimized. After reading your response, I spent couple of
    hours on optimizing it. Here are the numbers:

    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 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 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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    For more options, visit this group at
    http://groups.google.com/group/nodejs?hl=en?hl=en
  • Rick Waldron at Oct 30, 2012 at 6:13 pm

    On Tue, Oct 30, 2012 at 1:37 PM, Azer Koçulu 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 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 <waldron.rick@gmail.com>
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    For more options, visit this group at
    http://groups.google.com/group/nodejs?hl=en?hl=en
  • Azer Koçulu at Oct 30, 2012 at 8:03 pm
    You mean that benchmark doesn't contain any accessor or ak47 misses accessors?

    Here is how I define a property with getters and setters using ak47:

    function getter(d){ return Number(d); }
    function setter(d){ return new Date(d); }

    var date = a.property(new Date('1.1.1990'), getter, setter);

    And that benchmark case uses default accessors unlike the example above.
    On Tue, Oct 30, 2012 at 11:04 AM, Rick Waldron wrote:

    On Tue, Oct 30, 2012 at 1:37 PM, Azer Koçulu 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 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 <waldron.rick@gmail.com>
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    For more options, visit this group at
    http://groups.google.com/group/nodejs?hl=en?hl=en
  • Rick Waldron at Oct 30, 2012 at 6:43 pm

    On Tue, Oct 30, 2012 at 2:21 PM, Azer Koçulu wrote:

    You mean that benchmark doesn't contain any accessor or ak47 misses
    accessors?

    Here is how I define a property with getters and setters using ak47:

    function getter(d){ return Number(d); }
    function setter(d){ return new Date(d); }

    var date = a.property(new Date('1.1.1990'), getter, setter);

    And that benchmark case uses default accessors unlike the example above.
    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.

    Rick


    On Tue, Oct 30, 2012 at 11:04 AM, Rick Waldron wrote:

    On Tue, Oct 30, 2012 at 1:37 PM, Azer Koçulu 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 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 <waldron.rick@gmail.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    For more options, visit this group at
    http://groups.google.com/group/nodejs?hl=en?hl=en
  • Azer Koçulu at Oct 30, 2012 at 7:10 pm

    On Tue, Oct 30, 2012 at 11:36 AM, Rick Waldron 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.
    Rick


    On Tue, Oct 30, 2012 at 11:04 AM, Rick Waldron <waldron.rick@gmail.com>
    wrote:
    On Tue, Oct 30, 2012 at 1:37 PM, Azer Koçulu 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 <raynos2@gmail.com>
    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
    <waldron.rick@gmail.com>
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    For more options, visit this group at
    http://groups.google.com/group/nodejs?hl=en?hl=en
  • Rick Waldron at Oct 30, 2012 at 8:09 pm

    On Tue, Oct 30, 2012 at 2:40 PM, Azer Koçulu wrote:
    On Tue, Oct 30, 2012 at 11:36 AM, Rick Waldron 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 <waldron.rick@gmail.com>
    wrote:
    On Tue, Oct 30, 2012 at 1:37 PM, Azer Koçulu 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 <raynos2@gmail.com>
    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
    <waldron.rick@gmail.com>
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    For more options, visit this group at
    http://groups.google.com/group/nodejs?hl=en?hl=en
  • Azer Koçulu at Oct 30, 2012 at 8:09 pm
    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 wrote:

    On Tue, Oct 30, 2012 at 2:40 PM, Azer Koçulu wrote:

    On Tue, Oct 30, 2012 at 11:36 AM, Rick Waldron <waldron.rick@gmail.com>
    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 <waldron.rick@gmail.com>
    wrote:

    On Tue, Oct 30, 2012 at 1:37 PM, Azer Koçulu <azer@kodfabrik.com>
    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 <raynos2@gmail.com>
    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
    <waldron.rick@gmail.com>
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    For more options, visit this group at
    http://groups.google.com/group/nodejs?hl=en?hl=en
  • Azer Koçulu at Oct 30, 2012 at 7:08 pm
    By the way, I would prefer using Ak47 over Object.observe for some
    cases (if there isn't a significant performance issue). ak47 is not
    only for object properties, it's also for observing variables;
    var birthdate = ak47(new Date("1.1.1990")),
    age = ak47(birthdate, today, function(bd, td){
    return parseInt( (td - bd) / 31536000000 );
    });
    age()
    22

    It ensures all data structures are observable. And it's fairly simpler
    than JavaScript's new accessor and observation APIs.

    Here is a use case, assume we have a module like below:

    // a.js

    var foo = "hello",
    bar = hello + " world";

    module.exports = {
    foo: foo,
    bar: bar
    };

    // b.js
    var a = require('./a');

    a.foo = "What's up?"

    console.log(a.foo); // what's up?
    console.log(a.bar); // hello world

    When we ignore using classes (or another way to create properties) in
    CommonJS modules, we may have two copies of what we export from a
    module. One is internal, the other one is external when a client
    module overrides the property.

    To solve this issue, I was creating properties like below:

    var foo = (function(){

    var value = undefined;

    return function foo(newValue){
    if(arguments.length){
    value = newValue;
    }

    return value;
    };

    }());

    And after using this pattern for long time, I came up to the the idea of ak47.
    On Mon, Oct 29, 2012 at 5:42 PM, Rick Waldron 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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    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 nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    For more options, visit this group at
    http://groups.google.com/group/nodejs?hl=en?hl=en

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupnodejs @
categoriesnodejs
postedOct 30, '12 at 12:11a
activeOct 30, '12 at 8:09p
posts13
users4
websitenodejs.org
irc#node.js

People

Translate

site design / logo © 2022 Grokbase