November 22, 2013 Re: @property (again) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | On Friday, 22 November 2013 at 04:33:56 UTC, Kenji Hara wrote:
> After removing 'function' concept, 'func' always means function pointer or
> delegate. So we cannot call functions without parenthesis anymore. It is
> unacceptable change to me, and many D programmers would probably argue same
> thing.
>
It removes all ambiguities.
Optional parentheses are still an option when they aren't ambiguous.
void foo() {}
foo; // Can still call foo if we want to.
|
November 22, 2013 Re: @property (again) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Thursday, November 21, 2013 20:17:34 Walter Bright wrote:
> On 11/20/2013 11:51 PM, Jacob Carlborg wrote:
> > On 2013-11-21 07:06, Walter Bright wrote:
> >> The next release is going to be about bug fixes, not introducing regressions from new features(!). It's a short release cycle, anyway.
> >
> > You better watch what happens deep inside the pull requests then :)
>
> One of my own recent pull requests produced a regression :-(
Well, that's the only way that regressions get in there in the first place, so obviously the solution is to not change anything, right? ;)
On a serious note, at least we're now paying greater attention to regressions, which should be a definite boost to D's image from the standpoint of stability (and to some extent at least, I think that it already has).
- Jonathan M Davis
|
November 22, 2013 Re: @property (again) | ||||
---|---|---|---|---|
| ||||
Posted in reply to deadalnix Attachments:
| 2013/11/22 deadalnix <deadalnix@gmail.com>
> On Friday, 22 November 2013 at 04:33:56 UTC, Kenji Hara wrote:
>
>> After removing 'function' concept, 'func' always means function pointer or
>> delegate. So we cannot call functions without parenthesis anymore. It is
>> unacceptable change to me, and many D programmers would probably argue
>> same
>> thing.
>>
>>
> It removes all ambiguities.
>
> Optional parentheses are still an option when they aren't ambiguous.
>
> void foo() {}
>
> foo; // Can still call foo if we want to.
>
It will introduce a new ambiguity. See below example.
int foo();
void test(int function() fp);
void test(int num);
void main() {
test(foo); // which test is called?
}
Kenji Hara
|
November 22, 2013 Re: @property (again) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | On Friday, 22 November 2013 at 07:37:11 UTC, Kenji Hara wrote:
> 2013/11/22 deadalnix <deadalnix@gmail.com>
>
>> On Friday, 22 November 2013 at 04:33:56 UTC, Kenji Hara wrote:
>>
>>> After removing 'function' concept, 'func' always means function pointer or
>>> delegate. So we cannot call functions without parenthesis anymore. It is
>>> unacceptable change to me, and many D programmers would probably argue
>>> same
>>> thing.
>>>
>>>
>> It removes all ambiguities.
>>
>> Optional parentheses are still an option when they aren't ambiguous.
>>
>> void foo() {}
>>
>> foo; // Can still call foo if we want to.
>>
>
> It will introduce a new ambiguity. See below example.
>
> int foo();
> void test(int function() fp);
> void test(int num);
>
> void main() {
> test(foo); // which test is called?
> }
>
> Kenji Hara
The first one.
|
November 22, 2013 Re: @property (again) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | On Friday, 22 November 2013 at 07:37:11 UTC, Kenji Hara wrote:
> 2013/11/22 deadalnix <deadalnix@gmail.com>
>
>> On Friday, 22 November 2013 at 04:33:56 UTC, Kenji Hara wrote:
>>
>>> After removing 'function' concept, 'func' always means function pointer or
>>> delegate. So we cannot call functions without parenthesis anymore. It is
>>> unacceptable change to me, and many D programmers would probably argue
>>> same
>>> thing.
>>>
>>>
>> It removes all ambiguities.
>>
>> Optional parentheses are still an option when they aren't ambiguous.
>>
>> void foo() {}
>>
>> foo; // Can still call foo if we want to.
>>
>
> It will introduce a new ambiguity. See below example.
>
> int foo();
> void test(int function() fp);
> void test(int num);
>
> void main() {
> test(foo); // which test is called?
> }
>
> Kenji Hara
The first one.
Note that optional () is ambiguous by definition - the word optional convey this very idea. The ambiguity introduced by optional () must not be conflated by the one introduced by the existence of non first class function.
You stated that the existence of function is necessary for optional parentheses to exist, and I showed you that it is false. Nothing more, nothing less.
|
November 22, 2013 Re: @property (again) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 2013-11-22 05:17, Walter Bright wrote: > One of my own recent pull requests produced a regression :-( It seems like they wanted to merge a pull request even before 2.064 which would enforce @property in some way. This one: https://github.com/D-Programming-Language/dmd/pull/2305 -- /Jacob Carlborg |
November 22, 2013 Re: @property (again) | ||||
---|---|---|---|---|
| ||||
Posted in reply to deadalnix | On 2013-11-22 08:01, deadalnix wrote: > It removes all ambiguities. > > Optional parentheses are still an option when they aren't ambiguous. > > void foo() {} > > foo; // Can still call foo if we want to. int bar (); typeof(bar); What will the typeof resolve to, "int" or "int function ()"? -- /Jacob Carlborg |
November 22, 2013 Re: @property (again) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Friday, 22 November 2013 at 10:14:54 UTC, Jacob Carlborg wrote:
> On 2013-11-22 08:01, deadalnix wrote:
>
>> It removes all ambiguities.
>>
>> Optional parentheses are still an option when they aren't ambiguous.
>>
>> void foo() {}
>>
>> foo; // Can still call foo if we want to.
>
> int bar ();
> typeof(bar);
>
> What will the typeof resolve to, "int" or "int function ()"?
You know that this is the exact same problem as Kenji's packages in another way ?
|
November 22, 2013 Re: @property (again) | ||||
---|---|---|---|---|
| ||||
Posted in reply to deadalnix | On 2013-11-22 11:21, deadalnix wrote: > You know that this is the exact same problem as Kenji's packages in > another way ? I guess so. -- /Jacob Carlborg |
November 22, 2013 Re: @property (again) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Friday, 22 November 2013 at 12:40:17 UTC, Jacob Carlborg wrote:
> On 2013-11-22 11:21, deadalnix wrote:
>
>> You know that this is the exact same problem as Kenji's packages in
>> another way ?
>
> I guess so.
Short answer, foo is ambiguous with foo() when you enable optional parenthesis. That is the whole point of the feature. It doesn't require the concept of function as presented before, and is doomed to be a mess.
|
Copyright © 1999-2021 by the D Language Foundation