Artur Skawina wrote:
On 04/15/12 03:01, Piotr Szturmaj wrote:
Artur Skawina wrote:
@property is for functions masquerading as data, i'm not sure extending it
to pointers and delegates would be a good idea. What you are asking for is
basically syntax sugar for:

     struct CommonInputRange(E)
     {
         bool delegate() _empty;
         @property auto empty() { return _empty(); };
         @property auto empty(typeof(_empty) dg) { _empty = dg; };
         E delegate() _front;
         @property auto front() { return _front(); };
         @property auto front(typeof(_front) dg) { _front = dg; };
         void delegate() popFront;
     }


Yes, I was thinking about this, but it adds unnecessary overhead. I want to 
call delegates directly.

The compiler has to implement it internally exactly like that anyway. D's design
relies on such code being efficient - there is no preprocessor, no inline
attribute and no macros. The trivial functions have to be inlined, if that
doesn't happen it's a compiler bug. Once inlined, there's no overhead.

I wondered if properties can be inlined that way. But you have conviced me that indeed, inlining should help here. So, I'll use proxy properties. Thanks for your advice.

Reply via email to