Plot2kill 0.2

Michel Fortin michel.fortin at michelf.com
Sat Mar 5 13:42:53 PST 2011


On 2011-03-05 16:30:06 -0500, dsimcha <dsimcha at yahoo.com> 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
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d-announce mailing list