lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: global alignment tweak for ChordName


From: Jean Abou Samra
Subject: Re: global alignment tweak for ChordName
Date: Tue, 21 Dec 2021 22:54:29 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.1



Le 21/12/2021 à 22:29, David Kastrup a écrit :
Jean Abou Samra <jean@abou-samra.fr> writes:

[Valentin]
Hello Jean, hello David, hello Kieren,

you should even be able to write (if sten (ly:stencil-extent sten)),
as the stencil should always be a stencil or #f.

The two universally accepted values for any property
regardless of the predicate are #f and '(), so it
may still be '(), which is why checking with specific
predicates like this is often used in LilyPond's
source.
'() is a bit of an ugly cookie since it for some reason has been chosen
to be the default for unset properties (seems like a Lisp rather than
Scheme idea to me) but shouldn't be used by users for stuff not formally
fitting the predicate.

In my handwavy impression of trying to sort-of guess unwritten coding
conventions.


Hm. Reminds me of

\version "2.22.1"

{
  \once \override NoteHead.X-extent = #'()
  a'1
  \once \override NoteHead.X-extent = ##f
  a'1
}


Which happens because of

Grob::Grob (SCM basicprops)
{
  // [...]
  if (scm_is_null (get_property_data (this, "X-extent")))
    set_property (this, "X-extent", Grob::stencil_width_proc);
  if (scm_is_null (get_property_data (this, "Y-extent")))
    set_property (this, "Y-extent",
                  Unpure_pure_container::make_smob (Grob::stencil_height_proc,
Grob::pure_stencil_height_proc));
  if (scm_is_null (get_property_data (this, "vertical-skylines")))
    set_property (this, "vertical-skylines",
                  Unpure_pure_container::make_smob (Grob::simple_vertical_skylines_from_extents_proc,
Grob::pure_simple_vertical_skylines_from_extents_proc));
  if (scm_is_null (get_property_data (this, "horizontal-skylines")))
    set_property (this, "horizontal-skylines",
                  Unpure_pure_container::make_smob (Grob::simple_horizontal_skylines_from_extents_proc,
Grob::pure_simple_horizontal_skylines_from_extents_proc));
}

So I admit that my practice of setting properties
to #'() is not in line with the expectations of
part of the code base and I should take the habit
of writing ##f instead. Thanks for the notice.
But I wonder if we should update the comment in

bool
type_check_assignment (SCM sym, SCM val, SCM type_symbol)
{
  // [...]
  /*
    [...]
    TODO: should remove #f from allowed vals?
  */
  if (scm_is_null (val) || scm_is_false (val))
    return true;
  // [...]
}


Best,
Jean




reply via email to

[Prev in Thread] Current Thread [Next in Thread]