On 2012/10/03 06:20:10, janek wrote:
On Wed, Oct 3, 2012 at 8:01 AM, <mailto:[email protected]> wrote: > On 2012/10/03 05:10:27, janek wrote: >> After reading the comments in your code i don't understant what's
its
>> purpose. > > Sounds like I should rather delete the comments...
oh, no! They are well-written and provide insight into your code. It's just that i didn't know what we might need sessions for.
> I thought that the > documentation of define-session was rather clear: can you point out > where it falls down?
i think all i need is a short example, like "with sessions, you can do X and you won't get side-effects of Y kind".
Uh, I guess we have a fundamental misunderstanding here. We already _have_ sessions (you can call lilypond on several different .ly input files and have them processed tentatively independently). We just don't have any help for the programmer who tries dealing with them. What currently exists is that each session gets its fresh parser copy, and the parser variables are initialized from the state right before the first session started. For everything else, you are out on your own and responsible that all the variables in .scm files start with the same values each session, if necessary by reinitializing them in ly/init.ly. Except that nobody does. scm/midi.scm starts with ;;;;;;;;;;;;;;;;;; ;;; TODO: ;; this is broken: we should not ever export variables from Scheme. and indeed, it is broken. If you write to any of those variables, the changes persists across all sessions of a LilyPond run. define-session will declare a variable that has its value recorded at the start of the first session and reinstated at the start of each following session. It is supposed to provide a simple API for something that is so hard to do right that we have quite a bit of code in LilyPond that gets it wrong. It is not really providing anything new, just gives a face to something that programmers were expected to do right on their own, but which is really too hard to understand or explain. http://codereview.appspot.com/6588056/ _______________________________________________ lilypond-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-devel
