In Julia it is usually considered bad style to have the output type of 
function depend on the input values --- it is a good idea to get into the 
habit of writing "type-stable" functions whose output types depend only on 
their input types, and not on the values of their inputs, because this is 
essential to get good performance if the function is ever used in an inner 
loop of a computation.

In your case, I would normally just write two functions, foo() and 
plotfoo().   The former computes the data and returns it, and plotfoo() 
calls foo() to first compute and then plot the data.   (I don't see the 
advantage of @plot foo(), your option 3, vs. plotfoo().  A macro is a lot 
more messy to write and gives you no real benefit here.)

Reply via email to