Thread overview | ||||||
---|---|---|---|---|---|---|
|
February 07, 2011 Why non-@property functions don't need parentheses | ||||
---|---|---|---|---|
| ||||
Hi, I was wondering, why are we allowed to omit parentheses when calling functions with no arguments, when they are not @properties? Is there a good reason for relaxing the language rules like this? Thanks! |
February 07, 2011 Re: Why non-@property functions don't need parentheses | ||||
---|---|---|---|---|
| ||||
Posted in reply to %u | %u <wfunction@hotmail.com> wrote: > Hi, > > I was wondering, why are we allowed to omit parentheses when calling functions > with no arguments, when they are not @properties? Is there a good reason for > relaxing the language rules like this? This behavior is deprecated, but other features have had a higher priority than removing features that do not cause big trouble. :p -- Simen |
February 07, 2011 Re: Why non-@property functions don't need parentheses | ||||
---|---|---|---|---|
| ||||
Posted in reply to %u | On Sunday 06 February 2011 20:38:29 %u wrote:
> Hi,
>
> I was wondering, why are we allowed to omit parentheses when calling functions with no arguments, when they are not @properties? Is there a good reason for relaxing the language rules like this?
Because the compiler is not in line with TDPL yet. It used to be that @property didn't even exist and _all_ functions which returned a value and took no parameters could be used as a getter property and _all_ functions which returned void and took a single value could be used as a setter property. @property was added so that it could be better controlled. However, while @property has been added, the compiler has yet to be changed to enforce that @property functions are called without parens and that non-@property functions are called with them. It will be fixed at some point, but it hasn't been yet.
- Jonathan M Davis
|
February 07, 2011 Re: Why non-@property functions don't need parentheses | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | > It will be fixed at some point, but it hasn't been yet.
Oh cool, all right; thanks!
|
Copyright © 1999-2021 by the D Language Foundation