Fixing D's Properties

Oskar Linde oskar.lindeREM at OVEgmail.com
Fri Aug 17 09:41:18 PDT 2007


Chad J wrote:
> Properties are a blemish of the D language.  

[snip]

>     printf( "Click happened!" );
>     // please forgive the use of printf, I don't know whether you are using
>     //   Tango or Phobos.

(Seems D is regressing. There used to be a standard library.)

> ========================================
>           How to fix it
> ========================================
> 
> The most direct solution seems to be explicit properties.

[snip]

> This post is a bit lengthy.  So assuming you've read even part of it, 
> thank you for your time.

I agree with all issues listed with properties. Properties can't be 
callable both with and without () in order support delegate properties 
transparently, which means there has to be way to mark them as 
non-functions.

But I am not fully sure I understand your solution to these problems:

a.prop++;

What should this evaluate to assuming a.prop is an explicit property?
What if a.prop returns a reference type (class) with an opPostInc?

Likewise:

a.prop.y = 7;

What should this evaluate to? Any difference if a.prop evaluates to a 
reference type or a value type?

-- 
Oskar



More information about the Digitalmars-d mailing list