lilypond-user
[Top][All Lists]
Advanced

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

Re: Retrieve procedure name from within its definition


From: David Kastrup
Subject: Re: Retrieve procedure name from within its definition
Date: Thu, 22 Feb 2018 01:05:44 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Urs Liska <address@hidden> writes:

> Am 21.02.2018 um 20:17 schrieb David Kastrup:
>> Urs Liska <address@hidden> 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



reply via email to

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