Fully dynamic d by opDotExp overloading

Steven Schveighoffer schveiguy at yahoo.com
Sun Apr 19 07:22:27 PDT 2009


On Sun, 19 Apr 2009 02:00:50 -0400, Don <nospam at nospam.com> wrote:

> Steven Schveighoffer wrote:
>>  Yeah, I get that it can be done manually.  What I'm suggesting is that  
>> the compiler makes sure the static assert occurs if thbe result of  
>> compiling the template instance results in an empty function.  I look  
>> at it like adding methods to a class, you don't have to define which  
>> methods are not valid, all methods are by default invalid, only the  
>> ones you define are allowed.  With opDotExp, you are forced to define  
>> not only which calls to it are valid, but which ones aren't.  I'm  
>> saying, don't require defining which ones aren't, just like if you  
>> wanted to add methods to a class.  I'm sure I'm not explaining this  
>> perfectly...
>>  For example, the swizzle example that has been brought up many times,  
>> you want to handle 256 possible method names, but there are an infinite  
>> number of method names.  You don't care about defining what to do in  
>> all situations, only in the situations you care about.  But without  
>> compiler help, you have to.
>>  -Steve
>
> You'll get a "missing return statement", except in the case where it's  
> void. So it's only that one case where it's a problem.

I thought that the point of the auto return is that the dynamic function  
could return anything...

-Steve



More information about the Digitalmars-d mailing list