@property needed or not needed?
monarch_dodra
monarchdodra at gmail.com
Tue Nov 20 06:28:32 PST 2012
On Tuesday, 20 November 2012 at 14:13:51 UTC, Adam D. Ruppe wrote:
> On Tuesday, 20 November 2012 at 13:50:10 UTC, Regan Heath wrote:
>> Usually I'd agree but this is a case of a wart we should just
>> remove IMO. The fix for breaking cases is simple, add
>> @property.
>
> meh, I sometimes use it, but if overloading on @property works,
> that's easy enough to allow both ways.
>
> I use it in some big chaining things:
>
> Element.make("div").className("foo").value = "bar";
>
> vs
>
> auto element = Element.make("div");
> element.className = "foo";
> element.value = "bar";
That's a good point. If the property is a "setter", then both
"value = bla" and "value(bla)" is legal.
If the property is a getter, then only "=" works. But I think it
would be fine if "value(bla)" were tanslated to "value = bla" in
that case.
However, if you allow "foo = rhs" => "foo(rhs)" on a non-propety,
then code like this becomes legal:
writeln = 5;
And that's bullshit.
More information about the Digitalmars-d
mailing list