On 3/11/2011 2:49 AM, Kagamin wrote:
dsimcha Wrote:

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();

It's also easier to debug code if you store objects in variables. What if 
histogram is created with a bug, how would you diagnose it? If you have the 
histogram stored in a variable, you can put a breakpoint after the assignment 
and inspect the histogram, but your example doesn't provide a variable to 
inspect.

Well, then give it a name if you ever end up needing to. In general I hate this as an argument against terse but readable code because you can always make things into named variables very easily if you ever need to set a breakpoint there. Usually I use as few named variables as I can without hurting readability when I program, both to save typing and because I find it hard to think of good names for intermediate variables, so I end up naming them something horrible.

Reply via email to