Another problem with properties

Marcin Kuszczak aarti at interia.pl
Fri Aug 24 15:12:40 PDT 2007


Charles D Hixson wrote:

> I think the conflict is between declaration/definition and
> use.  A property is used AS IF it were a field.  (Possibly one
> that can only be either read from or written to.)  But the
> property when being defined *IS* a function.  It becomes a
> property by being defined in a particular form, which allows
> the compiler to recognize as uses of it code that appear to be
> uses of a field.

Same access syntax is biggest advantage of properties in D. In my first post
I just demonstrated that not in every case it is really same syntax.
It is possible that problem can be solved using rewriting of field as two
functions (see my last post). The problem for compiler would be to find
cases where there exist at least one function definition, and then rewrite
all fields into functions. When there are only fields in derived classes it
can be left as field...

-- 
Regards
Marcin Kuszczak (Aarti_pl)
-------------------------------------
Ask me why I believe in Jesus - http://zapytaj.dlajezusa.pl (en/pl)
Doost (port of few Boost libraries) - http://www.dsource.org/projects/doost/
-------------------------------------




More information about the Digitalmars-d mailing list