I'd also stick with the convention that ! means modification of one or more 
of the arguments (typically first argument), and definitely not have it for 
anything where there is some external state modification that is just an 
implementation detail.
(if somethings purpose is to set global state, such as set_rounding, I do 
like having the set_ to indicate that).

On Monday, September 28, 2015 at 1:03:52 PM UTC-4, Tom Breloff wrote:
>
> So it seems like there's not an enthusiastic agreement, but that the 
> slightly better answer is `immerse()` rather than `immerse!()`?   I suppose 
> I'll make some api changes to remove similar `!` instances, and the next 
> tag will be a minor version.  Thanks.
>
> On Mon, Sep 28, 2015 at 12:40 PM, Steven G. Johnson <steve...@gmail.com 
> <javascript:>> wrote:
>
>>
>>
>> On Monday, September 28, 2015 at 12:34:01 PM UTC-4, Tom Breloff wrote:
>>>
>>> A question regarding the use of `!` came up a few days ago (
>>> https://github.com/tbreloff/Plots.jl/issues/30#issuecomment-142995667), 
>>> and I wanted to quickly poll the users to get opinions.
>>>
>>> When a module maintains some sort of global state, and a method mutates 
>>> that global state, is it appropriate to add `!` to the end of the method 
>>> name?
>>>
>>> The example referenced asks why I named the method `immerse!()` instead 
>>> of `immerse()`, even though it doesn't have any arguments to mutate (it 
>>> changes the default plotting backend, which is part of the module state).  
>>> Which method name should it be? (and is it better or worse to provide both 
>>> options which would do the same thing?)
>>>
>>
>> See the discussion in https://github.com/JuliaLang/julia/issues/9262 ... 
>> and in particular the discussion about rand(), which modifies global state, 
>> but that is an implementation detail rather than a part of the definition 
>> of the function.
>>
>
>

Reply via email to