Re: @property method needs ()

2014-11-24 Thread ketmar via Digitalmars-d-learn
On Mon, 24 Nov 2014 06:56:08 +
Andre via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:

 Hi,
 
 in following example the @property method needs the ()
 otherwise compiler error  for row 24 is thrown.
 I cannot judge, whether the compiler behaves correct or not.
 
 Kind regards
 André
 
 ---
 
 alias fnError = void delegate(string s);
 
 interface IfSession
 {
   @property fnError addError();
 }
 
 class Session: IfSession
 {
   private fnError _addError;
   
   @property fnError addError()
   {
   return _addError;
   }
 }
 
 void main()
 {
   auto session = new Session();
   session._addError = delegate(s){};
   
   session.addError()(test); // Works
   session.addError(test); // Does not work
 }
a known thing. not sure if this is a known *bug* (seems that almost
nobody cares). compiler is obviously wrong here (and i believe that
it's wrong to accept `()` for properties at all), but i don't know if
this will ever be fixed.


signature.asc
Description: PGP signature


Re: @property method needs ()

2014-11-24 Thread via Digitalmars-d-learn
On Monday, 24 November 2014 at 08:35:08 UTC, ketmar via 
Digitalmars-d-learn wrote:

On Mon, 24 Nov 2014 06:56:08 +
Andre via Digitalmars-d-learn 
digitalmars-d-learn@puremagic.com wrote:



Hi,

in following example the @property method needs the ()
otherwise compiler error  for row 24 is thrown.
I cannot judge, whether the compiler behaves correct or not.

Kind regards
André

---

alias fnError = void delegate(string s);

interface IfSession
{
@property fnError addError();
}

class Session: IfSession
{
private fnError _addError;

@property fnError addError()
{
return _addError;
}
}

void main()
{
auto session = new Session();
session._addError = delegate(s){};

session.addError()(test); // Works
session.addError(test); // Does not work
}
a known thing. not sure if this is a known *bug* (seems that 
almost
nobody cares). compiler is obviously wrong here (and i believe 
that
it's wrong to accept `()` for properties at all), but i don't 
know if

this will ever be fixed.


There's hope that this will get fixed in the near future:
https://github.com/D-Programming-Language/dmd/pull/2305


Re: @property method needs ()

2014-11-24 Thread Andre via Digitalmars-d-learn

Thanks a lot for the info.

Kind regards
André

On Monday, 24 November 2014 at 09:26:16 UTC, Marc Schütz wrote:
On Monday, 24 November 2014 at 08:35:08 UTC, ketmar via 
Digitalmars-d-learn wrote:
a known thing. not sure if this is a known *bug* (seems that 
almost
nobody cares). compiler is obviously wrong here (and i believe 
that
it's wrong to accept `()` for properties at all), but i don't 
know if

this will ever be fixed.


There's hope that this will get fixed in the near future:
https://github.com/D-Programming-Language/dmd/pull/2305