Purity, @safety, etc., in generic code

Steven Schveighoffer schveiguy at yahoo.com
Thu Feb 21 06:17:18 PST 2013


On Thu, 21 Feb 2013 00:20:36 -0500, deadalnix <deadalnix at gmail.com> wrote:

> On Thursday, 21 February 2013 at 04:07:46 UTC, Steven Schveighoffer  
> wrote:
>> On Wed, 20 Feb 2013 21:50:01 -0500, deadalnix <deadalnix at gmail.com>  
>> wrote:

>>> Explain me how the hell you overload on implicit parameter types ?
>>
>> A method is simply a function that takes a hidden parameter of an  
>> object or struct.
>>
>> Really, a method with a signature Obj.foo() is a function with a  
>> signature foo(Obj this)
>>
>> A const method Obj.foo() const is a function with a signature  
>> foo(const(Obj) this)
>>
>> So it's equivalent to saying you can overload:
>>
>> foo(int *x)
>> foo(const(int) *x)
>>
>> To disallow this would be unnecessarily restrictive.
>>
>
> That is called avoiding the question.

I guess it's called not understanding the question?

-Steve


More information about the Digitalmars-d mailing list