Hi, IMO an extra ! is a small price to pay for consistency --- you are after all modifying an existing object. Avoiding globals is also a good strategy.
The lure of terser syntax for common use cases is always there, but I like to remind myself that I will be the person reading this code in 6 months or a year, and I will be grateful for all the clarity I can get. That said, maybe my use case differs from yours: I like to write functions that make plots, so my data analysis programs are more structured (eg standardize axes, titles, colors, plot types, etc). Another, more functional-style API could be what ggplot does in R, using the + operator to create a new plot with the extras. Best, Tamas On Fri, Apr 08 2016, Daniel Carrera wrote: > Hello, > > I was looking through the API for Plots.jl > > http://plots.readthedocs.org/en/latest/#api > > > Maybe I'm the only one, but I think all those exclamation marks are a bit > extraneous and feel like syntactic noise. I have been following Plots.jl > because I'm interested in plotting. My use of Julia comes down to either > making plots, or post-processing data so I can make a plots. I get the idea > from Plots.jl that functions that end in an exclamation mark are supposed > to modify an existing plot. So you get things like: > > plot!(...) # Add another plot to an existing one. > title!(...) > xaxis!("mylabel", :log, :flip) > xlims!(...) > xticks!(...) > > and so on... > > This means that in actual usage, almost every line I write needs to have an > extra `!`. To me this means that the `!` is not adding real information and > is just syntactic noise. I currently use PyPlot, so I use that as a point > of comparison. In PyPlot, all commands edit the current plot unless you > explicitly call `figure()` to create a new plot. You can also use clf() to > clear the current plot. I think this is something that PyPlot / Matplotlib > get right. The special syntax lines up with the less common action. > > I don't know if anyone agrees with me. I still think Plots.jl is a step in > the right direction and I'll keep cheering from the stands. I just wanted > to share my thoughts. > > Cheers, > Daniel.