[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using a hash-table context property
From: |
David Kastrup |
Subject: |
Re: Using a hash-table context property |
Date: |
Sat, 17 Feb 2018 21:13:56 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
Dan Eble <address@hidden> writes:
> After adding a property to define-context-properties.scm and
> initializing it in Score context in engraver-init.ly
> <http://engraver-init.ly/> to a hash table created with
> alist->hash-table, my engraver is able to get the table and use it.
> My problem is that the entries the engraver adds persist to the next
> score! I was expecting the next score to start again with the default
> table given in engraver-init.ly <http://engraver-init.ly/>. What am I
> missing?
Well, your included links seem a bit optimistic. I doubt you reserved
the engraver-init.ly domain just for this request.
At any rate, ly/declarations-init.ly contains
#(define default-fret-table (make-hash-table 101))
#(define chord-shape-table (make-hash-table 29))
#(call-after-session
(lambda ()
(hash-clear! default-fret-table)
(hash-clear! chord-shape-table)))
and there is a reason for that. It would not help restoring the hash
table to the original hash table at the end of a session since hash
tables are modified in-place and thus the hash table _is_ the original
hash table, just in modified state.
--
David Kastrup