Yet a new properties proposal
Dimitar Kolev
DimitarRosenovKolev at hotmail.com
Wed Jul 29 13:01:33 PDT 2009
language_fan Wrote:
> Wed, 29 Jul 2009 13:20:06 -0400, Dimitar Kolev thusly wrote:
>
> > Okay correct me if I am wrong but why not make properties like that:
> >
> > class a
> > {
> > int #a;
> > }
> >
> > The compiler can expand this to:
> >
> > int property_a(int new_a)
> > {
> > return this.a = new_a;
> > }
> >
> > int property_a()
> > {
> > return this.a;
> > }
> >
> > If you think that somebody is going to use property_a for whatever other
> > reason make it property_asdasdasd_a instead of property_a.
> >
> > Then just call it a#a = 3 or b = a#a =3.
>
> This sounds excellent. This way the properties would work exactly like
> publicly available members by default, only a bit slower unless the
> compiler does optimizations. The only use case anyone will ever need..
Where is the slow part when you have inline?
More information about the Digitalmars-d
mailing list