On 7/20/06, Peter Michaux <[EMAIL PROTECTED]> wrote:
On 7/20/06, Thomas Fuchs <[EMAIL PROTECTED]> wrote:
>
> The sole point of Prototype is to give the programmer a powerful, opinionated 
 toolset, to make programming JavaScript less pain (with some extra special 
sugar-on-the-top for Ruby devs).

How special is this sugar? Below are four randomly selected uses of
Prototype.js enumberable methods from Scriptaculous.

Here is one from Prototype.js itself. Look at how hard the JavaScript
has to work to use each(). It needs many function calls and even must
use bind. This is not the sugar's fault. But the sugar encouraged this
type of thinking.  In native JavaScript it is just a plain loop that
everyone can understand.

== Prototype.js

fragments.each((function(fragment){
 this.element.appendChild(fragment);}).bind(this));

== Native JavaScript

for(var i=0;i<fragments.length;i++){
 this.element.appendChild(fragments[i]);
}
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to