You need to amend the definition of the method in lily-guile.hh, since
it's also used directly in the C++ code, with no optional arguments:
53 SCM ly_assoc_get (SCM key, SCM alist, SCM def);
Hmm... I don't exactly understand the LY_DEFINE macro. Is it possible to
implement this
with overloading or have all C++ calls of ly_assoc_get to be changed to
use all four parameters?
+ programming_error ("Cannot find key ~S in alist, setting to ~S.",
ly_scm2string (key), ly_scm2string (default_value));
I think what Carl is getting at here is that you can't pass these
string values using format with programming_error () without adding
the macro `(_f', but this shouldn't be used in this case since it
internationalizes the message.
programming_error (to_string ("Cannot find key %s in achain, setting to
%s.",
ly_scm2string (key), ly_scm2string
(default_value)));
Is this basically the right way to do this?
There's a bigger problem here though, since it's not clear what the
value of the key is going to be before converting it: ly_scm2string
will only work if the scheme value is a string. This naturally
applies to default_value too, which could conceivably be any scheme
object.
What about adding a type check to ly_scm2string and add the possibility
to convert from symbols and numbers too?
Isn't there a guile built-in method for converting any scheme object in
a readable string?
Regards,
Michael
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel