Is the address-of operator (&) really needed?

Steven Schveighoffer schveiguy at yahoo.com
Thu May 31 04:58:42 PDT 2012


On Thu, 31 May 2012 07:45:54 -0400, Sandeep Datta  
<datta.sandeep at gmail.com> wrote:

>> But the only reason any of this is happening at all is
>> because of a specific ambiguity that was discovered with the old "empty
>> parens are optional" approach.
>
> Hmm interesting (esp since it works out in favor of what I wanted :) )  
> but TBH I do not have a problem with leaving the parens out if it does  
> not meddle with the way I'd prefer to use the language. But it seems you  
> can't have the cake and eat it too.
>
> Having said that, what is your opinion on dropping the ampersand? To me  
> it looks antiquated and out of place especially since it conjures up  
> images of unsafe pointers in C/C++.

If we removed the requirement for the ampersand, along with requiring  
parentheses for non-property functions, code which expected to call the  
function without parentheses would silently compile, but not do what was  
intended.

D aims to avoid making code silently switch behavior, so I don't think we  
can do this.

-Steve


More information about the Digitalmars-d mailing list