Urs Liska <[email protected]> writes:

> Am 21.02.2018 um 20:17 schrieb David Kastrup:
>> Urs Liska <[email protected]> writes:
>>
>>> Hi,
>>>
>>> is it possible to retrieve the name of a function currently being defined?
>>>
>>> myFunc =
>>> #(define-void-function (arg)(type?)
>>>    (display (function-that-returns-'myFunc'))
>> No.  define-void-function creates an anonymous function.  It's assigned
>> to myFunc here, but it could also get passed as an argument, made an
>> element of an array or whatever else.
>>
>> At the time the function is being defined, there is no name associated
>> with it.
>>
>
> OK, somehow I was afraid it is like that.
>
> Without much hope for a more positive answer: how about the other end
> of the process? When the function is actually executed it has been
> called by \myFunc. Isn't this information available somewhere, on a
> call stack or so? Could this be used to generate a message from the
> function that includes its name?

Unlikely.  You can call LilyPond with -dverbose and let it bomb out in
the function to see the backtrace for yourself (just call some
non-existent function or something).  I doubt that there is a name in
there somewhere.  If it is, you can likely get at it via Scheme.

-- 
David Kastrup

_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to