Re: alias to function literal, call without () not possible

2016-08-04 Thread ag0aep6g via Digitalmars-d-learn
On 08/03/2016 09:40 PM, Andre Pany wrote: Thanks for the info. Yes, I forgot the () for new Object; Adding the () for new Object() still returns the same error. `new Object` without parentheses is perfectly fine.

Re: alias to function literal, call without () not possible

2016-08-04 Thread Kagamin via Digitalmars-d-learn
Function pointers and delegates are not intended to allow optional parentheses. See also DIP23.

Re: alias to function literal, call without () not possible

2016-08-03 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 18:15:23 UTC, Anonymouse wrote: On Wednesday, 3 August 2016 at 17:16:10 UTC, Andre Pany wrote: [...] [...] ...is an alias for a delegate/function returning an Object. It is analogous to [...] [...] ...is a function accepting an Object parameter. In main

Re: alias to function literal, call without () not possible

2016-08-03 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 17:16:10 UTC, Andre Pany wrote: Hi, I just stumbled over this behavior. I am not sure whether the behavior is correct or not. [...] alias foo = () => new Object; ...is an alias for a delegate/function returning an Object. It is analogous to alias foo = () {

alias to function literal, call without () not possible

2016-08-03 Thread Andre Pany via Digitalmars-d-learn
Hi, I just stumbled over this behavior. I am not sure whether the behavior is correct or not. alias foo = () => new Object; void bar(Object o){} void main() { auto n1 = foo; bar(foo); } While first line in main is working fine, second line does not compile due to missing ().