Fake infix operators

Bill Baxter dnewsgroup at billbaxter.com
Mon Oct 29 00:27:55 PDT 2007


downs wrote:
> Daniel Keep wrote:
>> BCS wrote:
>>> Reply to Benjamin,
>>> ...
>>>> how the heck is that parsing?? Is the /map/ actualy this:
>>>>
>>>> (A / B) / C; ??
>>>>
>>> BTW if that is what you are doing, I may be force to do something
>>> totally EVIL to reclaim some ground in the "does nasty things with D"
>>> ranking. I have a few ideas though....  }:-)  (BBBBWWWWAAAA HAA Haa
>>> haaa.....)
> 
> Looking forward to it! :)
> The world needs more weird and disturbing things. Shake it up.
> 
>> IIRC, map is basically defined like this:
>>
>> struct map
>> {
>>   static map_ opDiv_r(T)(some_array_type!(T));
>> }
>>
>> struct map_
>> {
>>   some_array_type!(T) opDiv(T)(some_delegate_type!(T));
>> }
>>
>> Or something similar.
>>
>> 	-- Daniel
> 
> Yes exactly; though I have all the ugliness packed around in a template.

Does it compile down to the same code as just a plain call to a map() 
function?  (Or is there some other benefit that justifies the extra 
runtime cost and loss of readability?)

--bb



More information about the Digitalmars-d mailing list