On 17 February 2012 07:42, Jacob Carlborg <d...@me.com> wrote:
> On 2012-02-17 04:15, H. S. Teoh wrote:
>>
>> On Thu, Feb 16, 2012 at 06:49:40PM -0800, Walter Bright wrote:
>> [...]
>>>
>>> So it occurred to me that an overriding function could *inherit* the
>>>
>>> qualifiers from the overridden function. The qualifiers of the
>>> overriding function would be the "tightest" of its explicit qualifiers
>>> and its overridden function qualifiers. It turns out that most
>>> functions are naturally pure, so this greatly eases things and
>>> eliminates annoying typing.
>>
>>
>> I like this idea.
>>
>>
>>
>>> I want do to this for @safe, pure, nothrow, and even const.
>>
>>
>> Excellent!
>>
>>
>>
>>> I think it is semantically sound, as well. The overriding function
>>> body will be semantically checked against this tightest set of
>>> qualifiers.
>>>
>>> What do you think?
>>
>>
>> Semantically, it makes sense. And reducing typing is always good.
>> (That's one of my pet peeves about Java: too much typing just to achieve
>> something really simple. It feels like being forced to kill a mosquito
>> with a laser-guided missile by specifying 3D coordinates accurate to 10
>> decimal places.)
>>
>> The one disadvantage I can think of is that it will no longer be clear
>> exactly what qualifiers are in effect just by looking at the function
>> definition in a derived class. Which is not terrible, I suppose, but I
>> can see how it might get annoying if you have to trace the overrides all
>> the way up the inheritance hierarchy just to find out what qualifiers a
>> function actually has.
>>
>> OTOH, if ddoc could automatically fill in the effective qualifiers, then
>> this will be a non-problem. ;-)
>
>
> And if ddoc could show the inheritance hierarchy as well.
>

Jacob++


-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';

Reply via email to