@property (again)

deadalnix deadalnix at gmail.com
Thu Nov 21 20:04:00 PST 2013


On Friday, 22 November 2013 at 01:33:44 UTC, Kenji Hara wrote:
> 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.
>

The best way to solve the confusion is to get rid of one of the 
two concept altogether.

> 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.
>

It was indeed a really good feature in D1. It is however clashing 
with functional style quite badly.

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

This is an important misunderstanding of my position. The C era 
is bad, the D era is kind of better, but the exact same problem 
still exist. It is simply less visible.

The concept of function as you call it is useless and is both the 
source of the confusion you mention in C and the tricky cases you 
mention in D.


More information about the Digitalmars-d mailing list