proposal: @mixin functions to auto-mixin at call site

Dicebot public at dicebot.lv
Thu Sep 5 04:09:07 PDT 2013


On Thursday, 5 September 2013 at 10:51:19 UTC, deadalnix wrote:
> Stuff like data validation, or lazy initialization, anything 
> really data oriented usually benefit from that.
>
> Also, the dichotomy function call/field access is really not 
> that clear at the end. Accessing some data may require a 
> function call, go through a signal handler, or involve 
> complicated operation by the CPU (potentially 2 round trip to 
> memory).
>
> On the other hand, optimizer will remove many function calls 
> making them effectively field access. Even if it isn't inlined, 
> a simple function call could end up being faster than 2 round 
> trip to memory (the stack is hot).

I guess it was an answer to earlier property comment. Key concern 
here is not actually speed but ease to understand the program - 
it is pretty much the same deal as pure vs non-pure. Non-volatile 
non-shared field access is extremely unlikely to cause any 
side-effects in global program state and same is generally 
expected from something that looks like plain field access.


More information about the Digitalmars-d mailing list