The fluent interface is my biggest concern. Enforcing @property with strict semantics makes it impossible to use a fluent interface and property syntax for the same field. Again, in Plot2kill, the following pieces of code are equivalent and IMHO should be:<br>
<br>// Code piece 1<br>auto hist = Histogram(someArray, 100);<br>hist.barColor = getColor(255, 0, 0);<br>auto fig = hist.toFigure;<br>fig.title = "A histogram";<br>fig.xLabel = "XXX";<br><br>// Code piece 2:<br>
auto fig = Histogram(someArray, 100)<br> .barColor(getColor(255, 0, 0))<br> .toFigure<br> .title("A histogram")<br> .xLabel("XXX");<br><br>I consider this a very nice API. The with statement isn't a good substitute. I think it's ridiculous to break things like this in the name of ultra-rigid consistency or to solve a few weird corner cases w.r.t. functions that return zero-argument delegates, especially when the zero-argument delegate corner case can be solved by enforcing @property with loose semantics.<br>
<br><div class="gmail_quote">On Thu, Apr 21, 2011 at 6:02 PM, Robert Jacques <span dir="ltr"><<a href="mailto:sandford@jhu.edu">sandford@jhu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On Thu, 21 Apr 2011 17:54:34 -0400, Jonathan M Davis <<a href="mailto:jmdavisProg@gmx.com" target="_blank">jmdavisProg@gmx.com</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> On Thu, 21 Apr 2011 16:14:22 -0400, Jonathan M Davis<br>
> <<a href="mailto:jmdavisProg@gmx.com" target="_blank">jmdavisProg@gmx.com</a>><br>
><br>
> wrote:<br>
> >> On Thu, 21 Apr 2011 15:57:57 -0400, Jonathan M Davis<br>
> >> <<a href="mailto:jmdavisProg@gmx.com" target="_blank">jmdavisProg@gmx.com</a>><br>
> >><br>
> >> wrote:<br>
> >> >> How about the amount of existing code it breaks? How about the fact<br>
> >> >> that<br>
> >> >> it breaks using the same function for both method chaining and with<br>
> >> >> property syntax?<br>
> >> ><br>
> >> > Something like<br>
> >> ><br>
> >> > auto b = a.prop1.prop2.prop3;<br>
> >> ><br>
> >> > should work. I doesn't at present, but it should. There's a bug<br>
> >> > report on it.<br>
> >><br>
> >> What about auto b = a.prop1(5).prop2(6).prop3(7); ?<br>
> ><br>
> > I'd consider that to be the same. It should work, but it doesn't.<br>
> > There's a<br>
> > bug report for it.<br>
><br>
> Ahem, so you'd consider auto b = a.prop1(7); valid code under strict<br>
> property rules?<br>
<br>
Oh wait. You're right. I didn't read that right. No, that wouldn't be<br>
legal. That would be both getting and setting. Why would you even try and<br>
do that with a property, let alone with several chained together?<br>
</blockquote>
<br>
Oh. I suppose that that could be legal if the value of the property was<br>
callable with a single integer and that function returned a value. If so, that<br>
should be legal. But other than that, I can't think of why it would be legal<br>
to do that, or make any sense to for that matter.<br>
<br>
- Jonathan M Davis<br>
</blockquote>
<br></div></div>
See: <a href="http://en.wikipedia.org/wiki/Method_chaining" target="_blank">http://en.wikipedia.org/wiki/Method_chaining</a> and specifically, <a href="http://en.wikipedia.org/wiki/Fluent_interface" target="_blank">http://en.wikipedia.org/wiki/Fluent_interface</a><div>
<div></div><div class="h5"><br>
_______________________________________________<br>
phobos mailing list<br>
<a href="mailto:phobos@puremagic.com" target="_blank">phobos@puremagic.com</a><br>
<a href="http://lists.puremagic.com/mailman/listinfo/phobos" target="_blank">http://lists.puremagic.com/mailman/listinfo/phobos</a><br>
</div></div></blockquote></div><br>