@property - take it behind the woodshed and shoot it?
Nick Sabalausky
SeeWebsiteToContactMe at semitwist.com
Fri Jan 25 11:54:27 PST 2013
On Fri, 25 Jan 2013 15:29:21 +0100
"mist" <none at none.none> wrote:
> On Friday, 25 January 2013 at 14:18:43 UTC, TommiT wrote:
> > I don't see 1.foo the way you see it. I see it like this:
> >
> > @property bool is_zero(X value)
> > {
> > return value == 0;
> > }
> >
> > void main()
> > {
> > X value;
> > value.is_zero;
> > }
> >
> > It's just that X happens to be a built-in type, instead of a
> > user-defined type. But I don't see why should that matter.
>
> It is a tempting attempt to save two symbols of typing that
> completely breaks property semantics. I am objecting against it.
> With all my passion.
> Use value.is_zero() for UFCS magic.
I think you might have misunderstood it. What he's trying to do is use
UFCS to add a property to a type instead of adding a function.
More information about the Digitalmars-d
mailing list