[Proto-Scripty] Re: Hash#filter returns an Array?

2009-02-05 Thread kangax
On Feb 4, 1:20 am, T.J. Crowder t...@crowdersoftware.com wrote: [...] I'm not talking intuitive vs. non-intuitive (it's far too subjective), I'm talking the current documented (and implemented!) behavior. Remember that Enumerable is a contract, and code dealing with an Enumerable may not

[Proto-Scripty] Re: Hash#filter returns an Array?

2009-02-04 Thread ColinFine
On Feb 3, 2:18 pm, T.J. Crowder t...@crowdersoftware.com wrote: 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_

[Proto-Scripty] Re: Hash#filter returns an Array?

2009-02-04 Thread T.J. Crowder
Actually the code $H(originalHash.reject(...)) doesn't return the correct value. Ah, sorry 'bout that, should have tried it. Clearly I don't create hashes from arrays very often... ;-) -- T.J. On Feb 4, 8:49 pm, Brad bradavo...@gmail.com wrote: Actually the code

[Proto-Scripty] Re: Hash#filter returns an Array?

2009-02-03 Thread disccomp
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 t...@crowdersoftware.com wrote: Hi Brad, Sorry, I missed that

[Proto-Scripty] Re: Hash#filter returns an Array?

2009-02-03 Thread Richard Quadling
2009/2/3 T.J. Crowder t...@crowdersoftware.com: 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

[Proto-Scripty] Re: Hash#filter returns an Array?

2009-02-03 Thread T.J. Crowder
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.

[Proto-Scripty] Re: Hash#filter returns an Array?

2009-02-03 Thread Brad
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

[Proto-Scripty] Re: Hash#filter returns an Array?

2009-02-03 Thread T.J. Crowder
Perhaps this is a plea better left for the Prototype-core list. Like I said, I'm not a decision maker here. But breaking contracts is pretty well established as a Bad Idea. -- T.J. ;-) On Feb 3, 6:54 pm, Brad bradavo...@gmail.com wrote: TJ, thanks for correcting the docs. I hadn't noticed

[Proto-Scripty] Re: Hash#filter returns an Array?

2009-01-31 Thread Brad
Yup, found it - http://dev.rubyonrails.org/ticket/3592 It is indeed a bug in Prototype that hasn't been addressed. - Brad On Jan 30, 6:23 pm, kangax kan...@gmail.com wrote: On Jan 30, 6:05 pm, Brad bradavo...@gmail.com wrote: Why does Hash#filter return an Array instead of a Hash? It isn't