I just love these discussions.  :)

David





>________________________________
> From: Jafar Al-Gharaibeh <to.ja...@gmail.com>
>To: Steve Wampler <swamp...@noao.edu> 
>Cc: Unicon <unicon-group@lists.sourceforge.net>; Bruce & Breeanna Rennie 
><bren...@dcsi.net.au> 
>Sent: Tuesday, June 11, 2013 11:24:33 AM
>Subject: Re: [Unicon-group] Name of current procedure
> 
>
>
>Steve,
>
>
> I thought about &current and proc() but I didn't know I can use them together 
>this way. The only missing thing in your solution is a second argument to 
>proc(), so it becomes:
>
>
> image(proc(&current, 0))
>
>
>
>A quick test showed that the second argument corresponds to how deep to look 
>int the stack with 0 means the current level, 1 means one level down, up to 
>&level-1 which refers to the starting procedure in the co-expression.
>
>
>Bruce, below is a short program that makes use  of these facts. 
>
>
>Cheers,
>Jafar
>
>
>procedure main()
>  foo()
>end
>
>
>procedure foo()
>  write("current procedure is:", func_name())
>  boo()
>end
>
>
>procedure boo()
>  write("stack trace:")
>   write("---")
>   trace()
>   write("---")
>end
>
>
>procedure trace()
>    every write(image(proc(&current, 1 to &level-1)))
>end
>
>
>procedure func_name()
>    # The calling function is 1 level down
>    return image(proc(&current, 1)) ? {="procedure "; return tab(0) }
>end
>
>
>
>
>
>
>
>
>
>
>
>On Tue, Jun 11, 2013 at 7:49 AM, Steve Wampler <swamp...@noao.edu> wrote:
>
>On Tue, Jun 11, 2013 at 10:42:00PM +1000, Bruce & Breeanna Rennie wrote:
>>> Good evening Jafar,
>>>
>>> Thanks. I suspect that it will require a change/addition to the
>>> runtime at this point. I have a slight workaround that does the job
>>> for the time being.
>>
>>Try:
>>
>>     image(proc(&current))
>>
>>(or some variant - I'm off in the woods with bad network access).
>>
>>You'll have to play with the result to strip 'procedure', etc.
>>
>>Hope that helps!
>>
>>
>>--
>>Steve Wampler -- swamp...@noao.edu
>>The gods that smiled on your birth are now laughing out loud.
>>
>>
>>------------------------------------------------------------------------------
>>This SF.net email is sponsored by Windows:
>>
>>Build for Windows Store.
>>
>>http://p.sf.net/sfu/windows-dev2dev
>>_______________________________________________
>>Unicon-group mailing list
>>Unicon-group@lists.sourceforge.net
>>https://lists.sourceforge.net/lists/listinfo/unicon-group
>>
>
>------------------------------------------------------------------------------
>This SF.net email is sponsored by Windows:
>
>Build for Windows Store.
>
>http://p.sf.net/sfu/windows-dev2dev
>_______________________________________________
>Unicon-group mailing list
>Unicon-group@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/unicon-group
>
>
>
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Unicon-group mailing list
Unicon-group@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to