[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Naming question for get_property, set_property
From: |
Han-Wen Nienhuys |
Subject: |
Re: Naming question for get_property, set_property |
Date: |
Tue, 11 Feb 2020 22:01:02 +0100 |
On Mon, Feb 10, 2020 at 11:48 PM David Kastrup <address@hidden> wrote:
>
> So for longterm efficiency reasons I am planning to reimplement the
> get_property/set_property macros and underlying data structures that map
> to get_property_internal/set_property_internal. They are currently used
> across a number of types in a sort of polymorphism, and for "reasons" I
> need to know the type, so the call would become something akin to
>
> I'm curious about your plans. Can you say more?
> get_property (Grob, "color");
> or
> set_property (Grob, "stencil", SCM_BOOL_F);
>
> Now this is longer than before. Removing _property is not really an
> option since that lands us with std::set getting mapped to
> std::set_property_internal (or whatever).
>
> So Set and Get ? Or set_prop and get_prop ? Or Set_prop and Get_prop ?
>
> Or, since there are not all that many types to cater for, grob_set,
> grob_get, music_set, music_get, event_set, event_get (those obviously
> without the extra type argument) and what else I've been missing?
>
I recommend simply reverting to what we had before I unified things, ie.
get_grob_property
set_grob_property
get_music_property
.. etc.
the reason being that it is better if the source code looks like plain C++,
even though they might actually be macros that do advanced magic. Having
normal looking source code helps editors and tooling (astyle, clang-format)
make sensible decisions.
--
Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen
Re: Naming question for get_property, set_property,
Han-Wen Nienhuys <=