Re: [Rails-spinoffs] Re: Javascript Namespacing Question

2006-07-20 Thread Brian Feliciano
Thank you all guys! as a developer, im so lucky to be in this list.more power to this list! ___ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Re: [Rails-spinoffs] Re: Javascript Namespacing Question

2006-07-20 Thread Ryan Gahl
>> The trick is encapsulating the class definition as a whole inside the>> contructor method (using bind() to preserve the lexical scope of the>> containing class), > Both of these actions seem very unfriendly to me. Having to define my> entire object inside the constructor? Appending a bind(this)

[Rails-spinoffs] Re: Javascript Namespacing Question

2006-07-20 Thread Eric Anderson
Ryan Gahl wrote: The beauty though, Eric, is that you can use prototype to achieve this as well. Of course you can do private properties when using prototype. The support for doing so is provided by closures in the JavaScript language so you can do that with any JavaScript framework. All I wa

Re: [Rails-spinoffs] Re: Javascript Namespacing Question

2006-07-20 Thread Ryan Gahl
Some who read my code for this may point out that the Object.extend() was unnecessary, that I could have just done "this.publicVariable1 = ..." and "this.publicMethod1 = function(...) {...};", but I like to keep these things together using my initial syntax, which lends itself well to other tasks l

Re: [Rails-spinoffs] Re: Javascript Namespacing Question

2006-07-20 Thread Ryan Gahl
The beauty though, Eric, is that you can use prototype to achieve this as well. People have a habit of putting boxes around things and imposing imaginary constraints.  Look outside the box you've (not you specifically, Eric, that's the general "you") put the powerful prototype.js into and you'll

[Rails-spinoffs] Re: Javascript Namespacing Question

2006-07-20 Thread Eric Anderson
Brian Feliciano wrote: i know their difference coding-wise, but im a bit concerned about speed and performance and efficiency. (as you may have already noticed, im a bit paranoid about performance/speed) One more thing. The class-based OO emulated by prototype will be slightly slower because

[Rails-spinoffs] Re: Javascript Namespacing Question

2006-07-20 Thread Eric Anderson
JavaScript is a prototype-based OO language. Search on Google for the "Self" programming language for more info on this concept since it is the pioneer in this type of OO. Brian Feliciano wrote: is there a difference between: var ObjectName = Class.create(); ObjectName.prototype = { initial

[Rails-spinoffs] Re: Javascript Namespacing Question

2006-07-20 Thread Eric Anderson
Brian Feliciano wrote: while YUI does something like this: var ObjectName = function () { return { propertyOne: propertyValue, methodOne: function (argv1,argv2) { //do something here... } } }(); they both seem to work fine, but are there any difference? performace wise?