yeah, defineProperty was the thing that one of the developers at
RingoJS sugessted to me on github.
anyway, the "in" iteration is fixed, now i think only on the global pollution.
even with defineProperty, i would still add something to the global Array.
if time allows, maybe i will fork cpojer's github SSJS mootools and
provide a mootools without extending the globals.
for now, everything works here on my project.

thanks again

On Sat, Nov 13, 2010 at 1:33 PM, Christoph Pojer
<[email protected]> wrote:
> Yeah, never use for in to loop an array unless you use a
> hasOwnProperty check.
>
> @gabriel one thing you could do is - using 1.3 - go into Core.js and
> look up where we do all the .implement and .extend stuff and change
> that from putting it on the prototype to use the ES5 method
> "defineProperty" and set enumerable: false (look up the ES5
> specification). Not sure if RingoJS supports that yet, but v8 based
> implementations should.
>
> On Nov 13, 8:40 am, "Steve Onnis" <[email protected]> wrote:
>> Why would you ever ever use "in" when looping over an array? Yeah if the
>> array has elements you might be able to get away with it but you need to
>> remember that "in" loops over items within an object and when using it in an
>> array you get the "length" property of the array as part of the loop.
>>
>>
>>
>>
>>
>>
>>
>> -----Original Message-----
>> From: gabriel munteanu [mailto:[email protected]]
>> Sent: Saturday, 13 November 2010 6:13 PM
>> To: [email protected]
>> Subject: Re: [Moo] Re: server side mootools globals pollution
>>
>> Hi Christoph, thanks for the response.
>> more concrete, i was trying to use it in a ringojs project of mine,
>> and i would've not discovered this issue, until i hit a problem in
>> their skin implementation.
>> there was an array , and they were doing an iteration through the
>> array with the "in" operator:
>> something like this:
>> -------
>> method for each (part in parts)
>> --------
>> where parts was the array, and iterating like this, made part be also
>> the mootools functions aside from the array values.
>> at first, i didn't discover the ringojs problem, but the mootools problem.
>> it isn't an issue now, as i fixed it in ringojs.
>> i thought i could get here a link to another SSJS mootools which
>> behaves more like my taste, or an easy answer how i could fix your
>> github version
>> in order to keep Array extensions in the mootools module only.
>>
>> i read the blog post , and indeed you are right about adding functions
>> on global object is mootools way of doing things [and javascript's].
>> for example i love the bind on the Function object, and i want to keep
>> it in my future hacked mootools module.
>> Array, Number, String additions , hmm, not that much, i can do without
>> them, but that is just a personal taste.
>>
>> cheers
>>
>> On Sat, Nov 13, 2010 at 2:58 AM, Christoph Pojer
>> <[email protected]> wrote:
>> > Hello,
>>
>> > note that anything on my 2.0wip branch is purely experimental. You
>> > might wanna check out my guest blog post on David Walsh (FTW) Blog:
>> >http://davidwalsh.name/mootools-nodejswhich supports MooTools 1.3
>>
>> > Currently we have no plans to namespace and subclass any of the native
>> > types. The extensions to native objects on an ES5 implementation are
>> > fairly minimal. Why exactly is this an issue for you?
>>
>> > Bye
>>
>> > On Nov 12, 3:29 pm, gabriel munteanu <[email protected]> wrote:
>> >> Hi,
>> >> i took the server side mootools from
>> here:http://github.com/cpojer/mootools-core/tree/2.0wip
>> >> and built it with packager.
>> >> all goody.
>> >> now, when i load it in another module with require:
>> >> var MT = require('mootools.js');
>> >> i get MT.Class as expected, but i get Array global object polluted.
>> >> i don't think this is good. if i would like mootools flavored Array, i
>> >> would create a var myArr = new MT.Array();
>> >> is it possible to have MT.Array, and not pollute the global Array ?
>>
>> >> thank you in advance.
>>
>> --
>> jgabioshttp://bash.editia.info
>>
>> =======
>> Email scanned by PC Tools - No viruses or spyware found.
>> (Email Guard: 7.0.0.21, Virus/Spyware Database: 
>> 6.16180)http://www.pctools.com/
>> =======
>>
>> =======
>> Email scanned by PC Tools - No viruses or spyware found.
>> (Email Guard: 7.0.0.21, Virus/Spyware Database: 
>> 6.16180)http://www.pctools.com/
>> =======



-- 
jgabios
http://bash.editia.info

Reply via email to