Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: [QUIZ] Space Merchant (#71
Ross Bamford
3/22/2006 4:08:00 PM
On Thu, 2006-03-23 at 00:22 +0900, Mauricio Fernandez wrote:
> On Mon, Mar 20, 2006 at 05:41:56PM +0900, Ross Bamford wrote:
> > # This WeakHash implementation is by Mauricio Fernandez. I
> > # just added support for a default, and full key reclaimation
> > # to suit our need to have the default block run as and when
> > # (but only when) necessary.
> > #
> > # See:
http://eigenclass.org/hiki.rb?weakhash+a...
>
> I found your message indirectly via my httpd logs :)
>
I meant to put a thanks in the message body after I decided the code was
too long to post inline, but I forgot (sorry about that). Glad you saw
it, and thanks for the wicked implementation :)
> > class WeakHash #:nodoc: all
> [...]
> > def []( key )
> > value_id = @cache[key.hash]
> ========
> This will fail when you have hash collisions; I think it should be 'key'
> as in the original code (same goes for []=).
Ahh, of course. I think collisions are less likely given the specific
usage of WeakHash in this case (arrays with strictly object_id based
hashes, of objects that outlive the hash), but of course still possible
so I'll fix that up later today.
Cheers,
--
Ross Bamford - rosco@roscopeco.REMOVE.co.uk
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: [QUIZ] Space Merchant (#71
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password