Objective-D, reflective programming, dynamic typing

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Apr 3 09:54:10 PDT 2009


grauzone wrote:
> Andrei Alexandrescu wrote:
>> grauzone wrote:
>>> Andrei Alexandrescu wrote:
>>>> grauzone wrote:
>>>>> Andrei Alexandrescu wrote:
>>>>>> void fun(...)
>>>>>> {
>>>>>>     ... use void* _argptr and TypeInfo[] _arguments ...
>>>>>> }
>>>>>>
>>>>>> I'll ignore the fact that binding the arguments to magic, 
>>>>>> predefined names has the elegance of a fart interrupting a solemn 
>>>>>> moment. The larger problem is the type of _argptr.
>>>>>
>>>>> That surprises me. Your string mixin callbacks (or whatever is the 
>>>>> correct name for this idiom) in std.algorithm also use magic, 
>>>>> predefined names like "a".
>>>>
>>>> The situations are different. (The "$" in array index is also 
>>>> different.)
>>>
>>> How are the situations different?
>>
>> I don't have much time to explain, but the code in which a and b are 
>> used (which is restricted to an expression) cannot possibly define its 
>> own symbols called a and b. Also, user code can never define $. In 
>> contrast, _arguments is a valid, nonreserved D symbol that's just up 
>> for grabs.
> 
> K. Then rename _arguments to $arguments. Problem solved.

I said that's not even the problem. Recall I said "I'll ignore the fact 
that..."

Andrei



More information about the Digitalmars-d mailing list