On 2011-03-05 16:30:06 -0500, dsimcha <[email protected]> said:
The problem with the with statement idea is that you still need to
declare the variable. I often throw up quick anonymous plots with
anonymous Figure objects, like:
Histogram(someDataSet).toFigure
.title("A Title")
.xLabel("Stuff")
.showAsMain();
But does 'with' really need a variable name? Wouldn't that work?
with (Histogram(someDataSet).toFigure()) {
title = "A Title";
xLabel = "Stuff";
showAsMain();
}
I'd even say it's more readable this way since you're now using '=' to
set your properties.
I consider the ability to have the same function be called with both
syntaxes to be a beautiful thing, not a defect. If @property is ever
fully implemented, I'll nag for an @optionalproperty tag to bring back
this **feature**.
I've always been on the fence about this. I find it useful too, and I
like the visual effect of optional parenthesis. But returning anything
that is callable make things ambiguous to the reader and can even bring
bugs when it comes to generic programming; and ambiguity and bugs are
things I really don't want to see.
--
Michel Fortin
[email protected]
http://michelf.com/