Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Alternative generic hash function
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-05-29 (20:49)
From: Francois Pottier <Francois.Pottier@i...>
Subject: Re: Alternative generic hash function


> Why do you think the overhead would be high?

I was thinking of a recording mutability per-field, rather than
per-object. I agree that your proposal seems economical enough.

> there are plenty of clever tricks you can put in the runtime system
> that exploit the immutability of objects.

Would you care to elaborate? I am no compiler expert, but I'm not sure
why it would be so interesting to have this information at runtime,
where it is already too late to do code optimization.  That would allow
implementing the `pure' hash function proposed by Manuel Fähndrich, but
with a cost: the user would have to separate the mutable fields into a
sub-object, so as to allow the root object to be tagged as immutable.
Which other tricks do you have in mind?

François Pottier