On 30 août 2011, at 18:07, Jonas Sicking <[email protected]> wrote: > On Tue, Aug 30, 2011 at 2:32 AM, Julien Richard-Foy > <[email protected]> wrote: >> I think it’s better to return an immutable object (mutable objects are >> source of programming errors). But this immutable object should have >> traversing method (forEach, map, filter, etc.). > > Can you explain how mutable objects are a source of programming > errors. It seems that javascript made the choice a log time ago to use > mutable objects and settable variables, as opposed to for example > haskell.
Sure, have a look to these links: http://en.m.wikipedia.org/wiki/Immutable_object http://ofps.oreilly.com/titles/9780596155957/FunctionalProgramming.html But that's not so important. If you just add traversing methods to NodeList it would be a huge improvement.
