[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: outlet v. context
From: |
Carl Sorensen |
Subject: |
Re: outlet v. context |
Date: |
Tue, 7 Jul 2020 18:02:07 -0600 |
On Tue, Jul 7, 2020 at 5:32 PM Dan Eble <dan@faithful.be> wrote:
> On Jul 7, 2020, at 19:20, Carl Sorensen <carl.d.sorensen@gmail.com> wrote:
> >
> > The only time I would like a member function of a class to have a verb
> name is when it causes a side effect.
> >
> > When the job of a function is to return a result that can be used
> elsewhere, to me the goal is a result, and hence, it is a noun. flag()
> refers to an object -- a flag. get_flag focuses on the action, not the
> result. And most often, it's the result that I want -- which is a noun.
>
> I'll flag() your message and consider it later this evening.
>
:-). But you should note that flag() ing a message is a side effect --
you are changing the status of the message, not returning a characteristic
of the message. And as I said, I like verbs when the function is primarily
a side effect.
As you correctly point out, flag is both a verb and a noun. But as I
understand it in the domain of LilyPond, flag is virtually always used as a
noun, rather than a verb.
>
> Should we also consider the Scheme language?
> git grep 'ly:get' scm
>
At least as it is used in LilyPond, IIUC Scheme doesn't have member
functions. So we can't do grob.foo(), we do (ly::get_foo grob).
When we don't have member functions available, I am supportive of using
get_.
As I said, I'll support whatever is decided.
Thanks,
Carl