@property (again)

Kenji Hara k.hara.pg at gmail.com
Thu Nov 21 17:33:28 PST 2013


2013/11/22 deadalnix <deadalnix at gmail.com>
>
> Why do we make the distinction between a first class function and a
> function in the first place ?
>

(This is just my recognition, so might be not same with true history. But I
think there's not so big mistake.)

Historically, mixing function themselves and function addresses had
introduced huge confusion for non-expert C programers.
Not to repeat the mistake, D completely distinguished the two at the syntax
level - func and &func.

Fortunately it has introduced a good feature in D - when we use the name
'func' without & operator, it could be interpreted as a parenthesis-less
function call without ambiguity.
In D1, the feature was widely used.

However, the feature has a corner-case issue. If func returns a callable
object, function pointer or delegate,
does 'func()' mean either "call of 'func'" or "call the callable object
which returned by calling 'func'"?
That was particularly important problem for the Range.front API design in
D2.
To fix the issue, @property attribute has been introduced.

At least to me, your argument is just to return to the C era. I think it
will introduce huge 'regression'.

Kenji Hara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20131122/cb7d3aca/attachment.html>


More information about the Digitalmars-d mailing list