Marc Hohl <m...@hohlart.de> writes:

> Is this a feasible approach? What am I currently doing wrong?


> #(define bar-line-stencil-alist
>   '(("|" . thin-stil)
>     ("." . thick-stil)
>     ("" . empty-stil)
>     ))

>           (thin-stil (bar-line::simple-bar-line grob hair extent rounded))
>           (thick-stil (bar-line::simple-bar-line grob fatline extent rounded))
>           (empty-stil (make-filled-box-stencil (cons 0 0) (cons 0 extent)))
>           (stencil (assoc-get glyph bar-line-stencil-alist empty-stil))
>           )
>          
>          stencil
>          ))

That does not work.  stencil is set to a symbol, and that symbol is
never converted to a value.  When the function is being executed, the
_symbols_ thin-stil, stick-stil and empty-stil have long lost any
connection with the expressions that they were associated with while the
let-statement was being compiled.

You could write (local-eval stencil (the-environment)) to let the
lexical environment of the function compilation linger over long enough
to make this work, but you would earn a reward for the unnecessarily
most ugly and unstable code imaginable.

Instead, try using a case statement.  There is no need to calculate all
stencils and throwing most of them away.

-- 
David Kastrup


_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to