Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Hack

From: sunandadh:aol at: 27-Dec-2001 20:17

Hi Romano,
> I have found a not so standard method to find the funtion name and the code > inside a function. It works also if the funtion name is local: <snip> > What do you think of this method? Can be considered valid in all the > situations?
I think it's a very clever hack! Unfortunately it doesn't work for a function in ab object: HackO: make Object! [ hackF: func ["hackF" /local myself] [ error? err: disarm try [2 / 0] myself: get in err 'where print [ "my name is:" myself "^/my body is:" mold second get myself "^/my spec is:" mold third get myself ] ] ] HackO/HackF I'm disappointed with Rebol that something as simple as "What's the name of the current function?" isn't easily available, something like: print System/Current/Function-name A few weeks back I spent a while looking through the System object for a call stack. It must exist, and does exist for "Do Script.r" but I couldn't find it normal functions . They must be hiding it from us! If RT would put the stack in the system object along with everything else, it'd make formatting useful debugging reports a lot more useful. Sunanda.