Kangax, > Didn't we establish that this is a bug? ; )
Not as far as I'm concerned it isn't. It returns what its documented contract says it returns. The only error IMHO is in the interpretation that it would do something other than what the documentation says it will do. You're not suggesting it should break the Enumerable contract, are you? -- T.J. ;-) On Feb 3, 7:03 pm, kangax <[email protected]> wrote: > On Feb 3, 1:54 pm, Brad <[email protected]> wrote: > > > > > TJ, thanks for correcting the docs. I hadn't noticed that error > > either. > > > Are you suggesting that there no intersection of Prototype and Ruby > > communities? I only know of Prototype because of Ruby on Rails. > > > Let's take Hash#reject() as an example. Let's say I'm moving server- > > side Ruby code to my Prototype-enhanced client-side. > > > Ruby code: > > { "a" => 100, "b" => 200, "c" => 300 }.reject {|key, value| key == > > "b" } > > => {"a"=>100, "c"=>300} > > > Translated to Javascript: > > $H({ "a": 100, "b": 200, "c": 300 }).reject(function(i) { return i.key > > == "b" }) > > => [["a", 100], ["c", 300]] > > > Prototype returns an array? What good is an array if I started with a > > hash? It is intuitive that a reject() method returns a subset of the > > original data structure and not convert it to an entirely different > > one. > > Didn't we establish that this is a bug? ; ) > > -- > kangax --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" 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-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
