>
>
> ---------- Forwarded message ----------
> From: Carl Sorensen <[email protected]>
> To: Urs Liska <[email protected]>
> Cc: "[email protected]" <[email protected]>
> Bcc:
> Date: Wed, 8 Jul 2020 09:35:50 -0600
> Subject: Re: Naming question: \function
>
>
> On Tue, Jul 7, 2020 at 11:48 PM Urs Liska <[email protected]> wrote:
>
>> Hi all,
>>
>> I've started working on a package for displaying harmonic analysis
>> symbols. In the submodule for functional analysis I have (using the
>> original code of Malte Meyn) the main command \function, which gives
>> very obvious code like
>>
>>   \function (D_3-7)=>
>>
>> (for an intermediate dominant seventh with the "3" in bass position).
>>
>> What do you guys here think: Could the use of "function" as a command
>> name lead a) to confusion by people mistaking it as a language keyword
>> or b) to issues down the road if at some point one might want to create
>> a core LilyPond procedure with that name?
>>
>
> I think that \function is *not* a good name.  It's too general.
>
> An adjective added to it might resolve the problem.
>
> \harmonic_function
> \analysis_function
> \chord_function
> \structure_function
> \label_function
>
> HTH,
>
> Carl
>


In my view, all functions are verbs.

Calling a function is always "doing something", even if all you are getting
is a value.

When they are needed, the work a getter function does is to shield the
value from changing, outside of the setter.  If you don't care about such
protections or protocols, then just read/set the object property directly
and don't call a function.

The verb convention also helps make code more self-documenting.  Likewise,
the available get/set methods also self-document the API by showing which
properties are externally relevant.

The "no side effects" rule is very arbitrary and not a worthwhile
distinction in either what is or should be a function, or in how to name
functions.

In terms of naming conventions, in object-oriented languages, the
getFoo/setFoo or get_foo/set_foo convention is about as standard a
convention as any naming convention I've run across.


HTH,

Elaine Alt
415 . 341 .4954                                           "*Confusion is
highly underrated*"
[email protected]
Producer ~ Composer ~ Instrumentalist ~ Educator
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to