If not will this开发者_开发百科 be possible in R3 ?
Yes and No.
Technically, no.....Functions do not have names, they are anonymous. The same function may be assigned to more than one word, so the actual name is problematic.
do func [][print "hi world"] ;; this function explicitly has no name at all
f1: func [] [print "yo world"] ;; here's a single function with three names
f2: :f1
f3: :f2
In practice in some cases, Yes....You can grab the current name (if there is one) with a trick: capture an error, and the error object contains the name on the stack:
f3: func [/local eo] [eo: disarm try [0 / 0 ] print ["name is " eo/where]]
f4: :f3
Try it:
>> f3
name is f3
>> f4
name is f4
There is an exhaustive discussion here: http://www.rebol.org/ml-display-thread.r?m=rmlGLPJ
精彩评论