A Question of Style: Should inner constructor completion functions end with !

question
design

#1

In the Julia style guide, direct link below, it recommends appending an exclamation mark to the end function names which modify their arguments:

https://docs.julialang.org/en/stable/manual/style-guide/#Append-!-to-names-of-functions-that-modify-their-arguments-1

However, at the end of the section on inner constructors with incomplete arguments where a completion function is used, direct link below, the function complete_me does not have an exclamation mark at the end even though it modifies its argument.

https://docs.julialang.org/en/stable/manual/constructors/#Incomplete-Initialization-1

My opinion is that although the “!” requirement is less stringent on inner constructor completion functions, as they will never be called directly and only indirectly upon creation of a struct instance, the “!” should still be appended to the function name for code reading clarity.

However, I’m fairly new to Julia (recent migrant from Python). If any more experienced Julia devs have an opinion I’d be very curious to know.


#2

No – a bit of apples and oranges here. Inner constructors with or without a “completion function” construct, the functionwithbang!() signifies the overwriting of an extant value.


#3

I agree, perhaps submit a PR for the documentation (you can do this easily on Github).


#4

Submitted PR here: