lilypond-user
[Top][All Lists]
Advanced

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

Re: Naming RFC: Properties, property sets, presets


From: Flaming Hakama by Elaine
Subject: Re: Naming RFC: Properties, property sets, presets
Date: Tue, 14 Jul 2020 17:26:51 -0700



On Tue, Jul 14, 2020 at 12:15 AM Urs Liska <lists@openlilylib.org> wrote:
Hi Elaine,

Am Montag, den 13.07.2020, 15:31 -0700 schrieb Flaming Hakama by
Elaine:
>
> Yes, I did understand it to be more complex than my MWE.
>
> But the two things I wanted to validate are that
>
> * The preset is something you pass as part of a function invocation
>      \myFunction \with  { preset = style-two }
>
> * The preset resolves to a set of property/value pairs.

Yes, it does.

>
> Yes, I can see that since the property set has defaults, using
> "default" here would be inappropriate.  Also, since they are only
> used in the context of a call to \myFunction, they are not really
> acting like defaults.
>
> I'm not sure how much this concept is tied to appearance, but a set
> of styling properties is generally called a style sheet, like in CSS.
>
> In fact, the "default"-like character of this is really more similar
> to cascading style sheets.

The inheritance model is in fact borrowed from CSS.
But while probably 90% of usage will be about appearance the concept
itself is completely not tied to that, so I really don't want to imply
anything like that in the naming. Although I was pleasantly surprised
about "theme".

Property sets might as well define which statistical data from a
compilation to log, or how to construct output names, whether to
include git status info in the file's metadata or filename, whether to
base your composing algorithm on the weather forecast or stock market
data - or actually anything you like.

Therefore I won't follow your suggestion here. Right now I'm pondering
property subsets and property configurations.

BestUrs



If you want this concept to be more general beyond this example of appearance, I wonder whether you truly want the presets to be subsets of the property set.

Perhaps, the preset should be allowed to contain settings for various things, and not be limited to one property set.  So, when a property set encounters a preset, it can ignore any properties it does not know about.

Which is to say, the "subset" naming is inherently limiting and also not quite descriptive of the content or purpose.


The "pre" part of "preset" seems to indicate its place in the cascading rules?
If so, I think is a bad way to name it, as it is pre some things, and post other things.

Or, if "pre" is short for "predefined", that is also not telling us anything--the fact that you are using it means it's already been defined.

I think a better name would come out of its relation to the property set.

In this vein, I would offer the term "bundle"


\definePropertySet my-function.appearance
#`((thickness ,number? 1)
   (color ,color? ,red)
   (label ,markup? "")
   (extra-width ,number-pair? (0 . 0))
   (Y-position ,integer? 0))

myFunction =
#(with-property-set define-music-function (mus)(ly:music?)
  '(my-function appearance)
  #{
    \once \override NoteHead.color = #(property 'color)
    #mus
  #})

\definePropertyBundle \with {
    parent = default
    color = #magenta
} my-function.appearance style-two
{
    \myFunction \with {
        bundle = style-two
    } c'
}


HTH, 

Elaine Alt
415 . 341 .4954                                           "Confusion is highly underrated"
elaine@flaminghakama.com
Producer ~ Composer ~ Instrumentalist ~ Educator
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 

reply via email to

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