Congratulations to the D Team!

Walter Bright newshound2 at digitalmars.com
Tue Jul 10 19:52:49 PDT 2012


On 7/10/2012 7:42 PM, Timon Gehr wrote:
> On 07/11/2012 04:30 AM, Walter Bright wrote:
>> On 7/10/2012 6:07 PM, Timon Gehr wrote:
>>> (conceptually, the structures are immutable and infinite.)
>>
>>
>> What a minute - how are you doing toHash for an infinite structure?
>>
>> The only way you could is by doing toHash on the initial condition for
>> it. And that could be made const.
>>
>> Same for opEquals.
>
> I am not. The structure is used to obtain unique representations for
> values. Other parts of the code query the structure for the
> representations of values. That query cannot be const because the
> structure has to remember the representation it gives out if it has
> never been requested before. Values can be compared for equality by
> simple reference comparison that way, which speeds up the code
> tremendously.

How about create a new instance of a struct when a new representation is requested?



More information about the Digitalmars-d mailing list