DIP 50 - AST macros

Walter Bright newshound2 at digitalmars.com
Thu Nov 14 02:19:35 PST 2013


On 11/14/2013 1:08 AM, dennis luehring wrote:
> Am 14.11.2013 10:06, schrieb dennis luehring:
>> Am 14.11.2013 09:53, schrieb Walter Bright:
>>> On 11/13/2013 11:37 PM, Jacob Carlborg wrote:
>>>> On 2013-11-14 01:16, Walter Bright wrote:
>>>>
>>>>> Yes. But that's a good thing. I'd be pretty skeptical of the value of an
>>>>> AST macro that took 3+4 and changed it so it did something other than
>>>>> compute 7.
>>>>
>>>> You can still do stupid things like that with operator overloading. Not on
>>>> built-in types, but on user defined types. Every language allows you to do
>>>> stupid things, one way or another.
>>>
>>> Sure, but the issue is that expression templates are not for "int+int", but for
>>> "T+int". My question is what value would there be in a rewrite of "int+int" to
>>> mean something different.
>>
>> "int + int" could be part of an PC<->GPU kombination that generates
>> CUDA- and D-interchange code at compiletime
>
> or like Don Blade Engine with string mixins
>
> could produce "high performance x87 asm" code for normal D expressions
>

Good example, but still quite doable using type T instead.


More information about the Digitalmars-d mailing list