Hi, > Maybe filter should be an alias of findall for arrays, but shouldn't > it really return a hash for hashes?
FWIW (and it ain't much, I'm not a decision maker on Prototype stuff), in my opinion it would be an _extremely_ bad idea for Hash to break the contract documented for Enumerable. > ...in ruby, which Prototype is supposed to be modeled after. Prototype has been split off from Ruby for a long time now. I'd venture to say that most people using Prototype do not use and may well never have even seen Ruby. PHP seems to be the server-side language I see most in code snippets from people asking questions. -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Feb 3, 2:04 pm, disccomp <[email protected]> wrote: > Maybe filter should be an alias of findall for arrays, but shouldn't > it really return a hash for hashes? Especially if thats its behavior > in ruby, which Prototype is supposed to be modeled after. > > On Feb 3, 4:59 am, "T.J. Crowder" <[email protected]> wrote: > > > Hi Brad, > > > Sorry, I missed that Hash inherits from Enumerable (and I've filed a > > doc bug on it[1] and will fix it -- the doc page for Hash doesn't > > mention Enumerable). > > > So I think that's your answer: Hash#filter is an alias for > > Enumerable#findAll[2], which is documented as returning an array, not > > a Hash, and so having it return a Hash would be breaking the contract. > > > [1]http://prototype.lighthouseapp.com/projects/8886-prototype/tickets/535 > > [2]http://prototypejs.org/api/enumerable/findall > > > Sorry again to have missed the Enumerable thing in the first place. > > -- > > T.J. Crowder > > tj / crowder software / com > > Independent Software Engineer, consulting services available > > > On Feb 3, 12:25 am, Brad <[email protected]> wrote: > > > > It does. Hash still inherits from Enumerable, hence the usage of > > > Hash#findAll(). > > > > - Brad > > > > On Feb 2, 1:34 am, ColinFine <[email protected]> wrote: > > > > > On Jan 31, 11:11 pm, Brad <[email protected]> wrote: > > > > > > Yup, found it -http://dev.rubyonrails.org/ticket/3592 > > > > > > It is indeed a bug in Prototype that hasn't been addressed. > > > > > > - Brad > > > > > But it seems to me that it's gone away, because Hash no longer mixes > > > > in Enumerable, does it? > > > > > Colin > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
