lilypond-auto
[Top][All Lists]
Advanced

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

[Lilypond-auto] Issue 4462 in lilypond: Create a module variable access


From: lilypond
Subject: [Lilypond-auto] Issue 4462 in lilypond: Create a module variable access system for C++
Date: Thu, 25 Jun 2015 12:21:16 +0000

Status: Started
Owner: address@hidden
Labels: Type-Maintainability Patch-new

New issue 4462 by address@hidden: Create a module variable access system for C++
https://code.google.com/p/lilypond/issues/detail?id=4462

Create a module variable access system for C++

This replaces the previous "memoizing" ly_lily_module_constant with a
rather rigid system for importing/exporting/accessing module variables.

As opposed to the system used by ly_lily_module_constant, access will
continue to go through the respective module variables, making it
possible to also write to the respective variables.  In addition, this
ensures that any changes to the variables from the Scheme side will get
properly reflected in the C++ side, allowing for redefinitions when
debugging.

In a nutshell, ly_lily_module_constant ("ly:music?") would generally be
replaced with Lily::ly_music_p, a declaration of it looking like

  extern Variable ly_music_p;

would be placed in namespace Lily in lily/include/lily-imports.hh, and a
corresponding definition

  Variable ly_music_p ("ly:music?");

in namespace Lily in lily/lily-imports.cc .  The type Scm_module where
variables are organized can use pre-existing modules (in which case it
is initialized by calling the member function import ()) or are can
bring up a fresh module (in which case it is initialized by calling the
member function boot ()).  The startup is done in lily/guile-init.cc .

Since one of the most frequent uses of imported variables is for
function calls, the Scm_variable type (underlying the module-local
Variable type) has operator () defined to allow calling as a function.

So the previous

    scm_call_1 (ly_lily_module_constant ("ly:music?"), x);

can now be expressed as

    Lily::ly_music_p (x);


In order to avoid Srfi_1 import for a single function, also contains

Issue 4461: Don't use drop-right from (srfi srfi-1) in C++

It can perfectly amicably be replaced by more efficient code readily
available in the core.

https://codereview.appspot.com/249920043


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings



reply via email to

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