toHash => pure, nothrow, const, @safe

Alex Rønne Petersen xtzgzorex at gmail.com
Tue Mar 13 09:03:22 PDT 2012


On 13-03-2012 16:56, deadalnix wrote:
> Le 13/03/2012 01:50, Walter Bright a écrit :
>> On 3/12/2012 4:11 AM, deadalnix wrote:
>>> For struct, we have inference,
>>
>> ? No we don't.
>>
>
> Ok my mistake. So why not dig in that direction ?
>
>>> so most of the time attributes will correct.
>>> const pure nothrow @safe are something we want, but is it something we
>>> want to
>>> enforce ?
>>
>> Yes, because they are referred to by TypeInfo, and that's fairly useless
>> if it isn't const etc.
>
> I always though that TypeInfo is a poor substitute for metaprograming
> and compile time reflexion.

Yes, and in some cases, it doesn't even work right; i.e. you can declare 
certain opCmp and opEquals signatures that work fine for ==, >, <, etc 
but don't get emitted to the TypeInfo metadata, and vice versa. It's a mess.

-- 
- Alex


More information about the Digitalmars-d mailing list