Is [] mandatory for array operations?

Bruno Medeiros brunodomedeiros+spam at com.gmail
Thu May 13 07:07:46 PDT 2010


On 04/05/2010 21:19, Andrei Alexandrescu wrote:
> Walter Bright wrote:
>> Don wrote:
>>> Walter Bright wrote:
>>>> Don wrote:
>>>>> There are several compiler bugs relating to array operations, and
>>>>> almost all relate to this issue. I'd like to fix them, but I need
>>>>> to know which way it is supposed to work.
>>>>
>>>> The [] should be required. I worry that otherwise there will be
>>>> ambiguous cases that will cause trouble.
>>> Excellent.
>>
>> Glad we agree. An example is the C hack where if foo is a function,
>> then &foo as well as foo mean the address of the function. This little
>> ambiguity, originally meant as a convenience, has caused much grief.
>
> In the same vein, probably it's time to bite the bullet and require
> @property for parens-less function calls.
>
> Andrei

Yes please. That ambiguity has bitten me in the past, in a case where 
the return value of the function was a function/delegate.

Basicly if you change a variable(of delegate type) into a property, code 
that uses the variable as a function call will break. This is because 
the function call will only call the property getter, not the actual 
delegate.

-- 
Bruno Medeiros - Software Engineer


More information about the Digitalmars-d mailing list