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

Ary Borenszweig ary at esperanto.org.ar
Wed Sep 4 07:44:49 PDT 2013


On 9/3/13 5:47 PM, Andrej Mitrovic wrote:
> On 9/3/13, Jacob Carlborg <doob at me.com> wrote:
>> With properties you never know if you're invoking a method or accessing
>> a field:
>>
>> foo.data; // call method or access field?
>
> Yeah but it does something with data on its own side. If this becomes
> an implicit mixin, it could do something with code at the call site.
> E.g.
>
> auto st = getSecurityToken(...);
> updateGui();  // what if this becomes a mixin and ends up reading 'st'
> and displaying it on the screen?
>
> It is equivalent to using globals everywhere in your codebase.

Why would anyone do that?

Do you use other people's source code without reading the documentation 
or reading the source code?

How would the author of "updateGui()" know that you named your variable 
"st"?

What if "updateGui()" does "rm -rf /" ?

What if "updateGui()" always does a null pointer dereference?

Ah, the language is too dangerous. I say we should remove function calls 
from the language.



More information about the Digitalmars-d mailing list