memoize (is this a fix for overloading?)

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Jan 4 15:06:45 PST 2011


On 1/4/11 4:49 PM, %u wrote:
>> There's still the risk of keeping multiple hashes. Consider:
>
>> ulong fun(ulong n) { ... }
>> alias memoize!fun mfun;
>
>> mfun(5); // creates hash ulong[int]
>> mfun(5u); // creates hash ulong[uint]
>> mfun('5'); // creates hash ulong[char]
>
>
> Ohhh I see... so you're basically looking for a compile-time version of overload
> resolution, right? Because things seem to be getting complicated very quickly.

It's not that complicated; we'll be able to achieve it somehow. 
Overloads are compile-time entities so they should be easily inspectable.

> (An unrelated side note: I'm new to newsgroups, and I was wondering, what program
> do people mainly use for communication? I'm using the web interface, but do most
> people use Thunderbird or something? Thank you!)

I use Thunderbird with NNTP, which is better than the Web interface.


Andrei


More information about the Digitalmars-d mailing list