That's a great idea and it's one that has been brought up MANY times before (and some people have gone so far as to do it themselves and a few people have even forked prototype functionality into libraries that are a little more lightweight). Unfortunately, the problem here is that Prototype.js gets all of its power and smallish size by using it's own functions extensively throughout the code. This gives Prototype the ability to have a relatively small library (~70KB that compresses with gzip to ~15k) with a LOT of functionality.
An easy example to understand is the $ function. A few years ago when Prototype popularized this as a shortcut to document.getElementById(), it was trivial to take JUST this function and use it in your code because all it did was take the arguments passed to the function and returned either an array of elements or returned an element by itself. However, in recent versions of prototype, the $ function is now doing a LOT more, and if you wanted to grab it, you'd need these things: $(), Element, Element.extend(), Object.extend(), Object.clone(), Element.extend.cache, Element.Methods, Form, Form.Element, Form.Element.Methods, And that's just at the first level of function calls for $(). Once you get into the Methods defined in Element.Methods, now you're looking at various other functions that are required like all of the extensions to String.prototype and Array.prototype and you'll also need the Class.create() functionality as well as the Enumerable Class definition. This level of interlocking functionality makes Prototype tick, so to speak, and simply would make an ala carte version of Prototype at best a logistical nightmare and at worst an impossibility. My final thought here is that even though YOU aren't using all of the functionality of Prototype.js manually, Prototype.js is using all of it's functionality. There are bits and pieces that you can safely remove if you're not going to use them, but the vast majority of the library needs to stay right where it's at. With gzip compression or Rhino-based JavaScript minification, you can shrink Prototype.js down in size considerably, so that's probably your best bet if size is your concern. Plus, I've found that just because I may not currently be using a function or method from Prototype.js currently, I won't ever learn to use it if it's not available. By keeping everything in place, you've at least got a starting point to begin looking for something you need to develop. Good thought though. If you could build a working "compiler" for Prototype that would let me select the functionality I need and provide a working model for this system, I'd definitely eat my words and be more than happy to use it in our production environments, but I still think that it's probably not possible. Good luck! -E On 3/27/07, Leone Parise <[EMAIL PROTECTED]> wrote: > > Hi Group! > > I am a J2EE Developer and started to use Prototype framework for Ajax > an other effects on my new works. > > It's is very powerfull, simple and made my work easyer to do, but it's > to big. > > I think that 50% or more of the library that I didn't need (yet). > > My Idea is create a system to compile a custom library with only > methods that I need. > > We can map each function(and its dependecies) a put it into a > DataBank. > > When someone download the library can select the functions tha he > wants and make his own library. > > It's only an Idea to improve Prototype. > > Tank's. > > Leone Parise > > > > > -- Eric Ryan Harrison --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" 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/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---
