working with attributes

Walter Bright newshound2 at digitalmars.com
Sat Jan 13 02:23:56 UTC 2024


On 1/12/2024 3:13 PM, Timon Gehr wrote:
> On 1/12/24 21:52, Walter Bright wrote:
>> On 1/12/2024 6:54 AM, Timon Gehr wrote:
>>> Do you think virtual methods and runtime delegates were a mistake in general?
>>
>> I don't like opApply() because it does a hidden rewrite of the statements in 
>> the function that makes the semantic analysis fragile, ugly and clumsy.
>>
>> I'm a bit amazed it works at all :-/
>>
>> Virtual methods and runtime delegates don't have this problem.
> 
> My own `opApply` implementation is relatively straightforward:
> 
> https://github.com/tgehr/d-compiler/blob/master/semantic.d#L8868-L8915
> https://github.com/tgehr/d-compiler/blob/master/semantic.d#L9174-L9227
> https://github.com/tgehr/d-compiler/blob/master/semantic.d#L9882-L9889
> https://github.com/tgehr/d-compiler/blob/master/semantic.d#L9972-L9985
> https://github.com/tgehr/d-compiler/blob/master/semantic.d#L10037-L10047
> https://github.com/tgehr/d-compiler/blob/master/semantic.d#L10059-L10064

I'm not sure if it is straightforward or not! Consider that the original 
implementation was implemented in C-with-Classes, not D templates!


More information about the Digitalmars-d mailing list