betterC question

Dibyendu Majumdar d.majumdar at gmail.com
Thu Nov 19 12:15:23 UTC 2020


On Thursday, 19 November 2020 at 09:23:25 UTC, Jacob Carlborg 
wrote:
> Yes, calling `writeln` like that is a bad idea. That was a bad 
> example.
>
> But the actual reason is, this is how D implements properties 
> [1]. Any function that doesn't take an argument can be called 
> without parentheses. Any function which takes a single argument 
> can be called like setting a field.

I think that properties on an object are a special case - but 
treating an random function identifier as callable is still bad.


More information about the Digitalmars-d-learn mailing list