About that specific paragraph -
this is about how JS works. JS is a prototypical language. inheritance is
derived from the prototype of an object (i'm sure this sentence isn't as
correct as it could be but i hope its good enough for this explanation).
Mootools does a lot of it's job by extending the native JS objects -
Function, Element, etc, to make JS better. it does this by extending the
basic prototypes of these objects, thus supplying new methods and behaviors
to their siblings (like Function.bind, Array.each etc).
JS objects literals ({}) are very basic implementation of hashes. The
problem is that unlike other native objects, the object literal prototype
cannot be extended. so instead, Mootools supplies a wrapper class that will
supply you with extended Hash functionality - getters, setters, iterators,
mappers etc
-----------
אריה גלזר
052-5348-561
5561On Sat, Jan 23, 2010 at 23:45, waveydab <[email protected]> wrote: > Hi, > > I'm trying to defog a little on Hash's. My past experience with them > was in Perl and Python's dictionaries. But this little passage from > Mootools doc keeps bothering me. I've tried to make sense of it but > I'm still having trouble. First of all, I didn't know that there was > an "accounting for prototypes" within a setter or getter. An object > has properties which may or may not have originated thru a prototype > but I can't see a requirement for any explicit referencing the > prototype of such an object for a setter/getter. I'm even less clear > about what the "iterating" is about. > > "A custom Object ({}) implementation which does not account for > prototypes when setting, getting, or iterating. Useful because in > JavaScript, we cannot use Object.prototype. Instead, we can use > Hash.prototype!" > > waveydab >
