Deltares / BasicModelInterface.jl

Basic Model Interface specification for Julia
MIT License
7 stars 1 forks source link

Use the '! convention' in function names #3

Closed BSchilperoort closed 1 week ago

BSchilperoort commented 1 week ago

The julia style guide specifies that a function which modifies the input arguments should end with an !. Following this convention, many functions should end with a !. E.g. update or finalize.

Slightly deviating from the SIDL names (in style) should not be a problem. Take the C++ implementation for example, which uses CamelCase (e.g. GetComponentName).

The BMI best practice also state:

Constructs and features that are natural for the language should be used when implementing a BMI. BMI strives to be developer-friendly.

I was wondering if this was this a conscious design decision, or not? I do realize that this modification would break the julia bmi completely, so I don't expect this so change anytime soon.

Related to https://github.com/csdms/bmi-example-julia/issues/8

visr commented 1 week ago

Yeah I did consider this, but went for cross language consistency here. As mentioned in the style guide it is just a convention, that has exceptions as well. In the case of sort and sort! it helps a lot to communicate, since whether it mutates is not clear from the word sort. But from the BMI function names it is quite clear whether they mutate or not, with set_*, update and finalize. Note that finalize, not finalize! is also a Base Julia function.

BSchilperoort commented 1 week ago

OK that's clear. At least it's documented now for future reference :)