I am sure this can be improved, but a simple approach:
exname=: verb define
NB. Query stack, jump to next verb above 'exname' (ie down column 0)
>{.}.{."(1) 13!:13 ''
)
foo =: verb define
exname ''
)
NB. Stack suspension must be ENABLED for this to work ...
13!:0(0) NB. If NOT ENABLED ... no name returned
foo ''
13!:0(1) NB. But if ENABLED ... works OK
foo ''
foo
Rob Hodgkinson
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Anssi Seppälä
<[EMAIL PROTECTED]>
Sent: Thursday, 27 July 2006 2:07 PM
To: Programming forum
Subject: [Jprogramming] asking the current function's name
Is there a method to get or call the function's name of current
execution. This would be usefull developing logging & monitoring
methods. If the method had name "thisfunction" it could work like this:
foo=: 3 : 0
thisfunction ''
)
foo ''
foo
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm