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

[REBOL] Re: Hack

From: sunandadh:aol at: 28-Dec-2001 14:45

Hi Joel,
> The real issue is that functions are first-class values in > REBOL (i.e., just as with strings or numbers, they can be > created at will, passed as arguments, returned as the result > of an evaluation, etc...) As a consequence of this fact, > it is as meaningful/less to talk about the "name of the > current function" as it is to talk about the "name of the > current 2", IMHO.
That's clever stuff, but I think it misses the point I'd like to make. Take these three functions: FuncA: func [] [2 / 2 FuncB] FuncB: func [] [2 / 2 FuncC] FuncC: func [] [2 / 2] Change any of those 2 / 2 to 2 / 0, invoke FuncA and you'll get a message like: ** Math Error: Attempt to divide by zero ** Where: FuncC ** Near: 2 / 0 With the 'Where giving me the name of the function. The only way we know to get that name is (see Romano's original post) to force an error. That is not a first-class API in my opinion <g>. And all the more so as the 'Where field is described in the Core User Guide (2.3 Sept 2000) as reserved so we can't rely on that method long term. I agree that if a function isn't named then Rebol can't show a name....But it doesn't follow that therefore it can't give me any names at all, ever. The Rebol way? IOTYWYWTKIYBSF I'll only tell you what you want to know if you break something first Sunanda.