Janek Warchoł <[email protected]> writes:

> Hi,
>
> it's time to ask a n00b question and get the elephant (that was
> bothering me for a couple years) out of the room: why do we have - and
> use! - both get_property and internal_get_property?  We ought to use
> get_property everywhere, right?

Correct.  (internal_)get_property is analogous to
(internal_)set_property, and at least instrumented_set_property can
receive additional file/line number information for diagnostics from the
set_property macro.

> The more Lily code i read, the more i see that get_property is used
> almost everywhere else...  Why not define get_property as a member of
> the Grob class, too?

Because it cannot be made to refer to file/line number information then
or be used for instrumentation in a similar manner as set_property.

> We are also converting property names from strings to symbols
> everywhere - for example
>
> SCM meta = info.grob ()->internal_get_property (ly_symbol2scm ("meta"));
>
> What's the reason for that?

Sloppiness?
I see no compelling reason not to use

    info.grob ()->get_property ("meta");

here.  However, it's conceivable that any instrumentation of
get_property would try recording the accessed grob type, and finding
that might require looking in "meta".  So it's conceivable that some
calls of internal_get_property that dig into internals of the grob
rather than "regular" properties have been written using
internal_grob_property in order to avoid useless info or infinite
lookups.

I am not suggesting that this is done consistently and with a rigid
scheme in mind.  I am just pointing out some possible historic
reason to make the difference but have not verified to which degree that
theory is supported by the code.

>> https://codereview.appspot.com/127860043/

-- 
David Kastrup

_______________________________________________
lilypond-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to