Hello Werner, the problem here is not really ly:context-property, but the C-implementation Context::internal_get_property, which uses SCM_EOL as default value. So Lilypond’s guile interface cannot know if a NULL is actually set or if the context property is not set. It would be possible to check before whether the context in question has this property set. Sadly we do not have a scheme handle on the here_defined macro, but only on the where defined macro.
Still we can use something like (eq? (ly:context-property-where-defined context sym) context) to check if a symbol is defined in a specific context. So we could use something like: #(define (context-has-defined? context sym) (eq? (ly:context-property-where-defined context sym) context)) #(define* (context-strict-get-property context sym #:optional (def '())) (if (context-has-defined? context sym) (ly:context-property context sym) def)) Cheers, Valentin Am Sonntag, 10. Juli 2022, 13:46:58 CEST schrieb Werner LEMBERG: > The documentation of `ly:context-property` is as follows. > > -- Function: ly:context-property context sym def > > Return the value for property SYM in CONTEXT. If DEF is given, > and property value is ‘'()’, return DEF. > > I have a use case where I want to say > > ``` > \set SYM = #'() > ``` > > i.e., I explicitly want to override the default DEF with an empty > list. How can I do that? > > > Werner
signature.asc
Description: This is a digitally signed message part.