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

[REBOL] Re: Better error messages?

From: sunandadh:aol at: 9-Dec-2001 18:26

Hi Volker,
> > And it gets me wondering if it could be done the other way round. For > > example, I define a function called (say) LoggedFunc:
Thanks for your long reply, and sample code. What you've done is very clever, and if I understand it right, it will be of interest to anyone who is developing Rebol code for use by others. Can I summarise what I think you've done for everyone's benefit? Problem: Rebol error messages give way to little context. Useful for development maybe, but underpowered for code deployed in the field. Volker's solution. 1. Be structured. Embed all Funcs in Objects: MyObject1: [Myfunc1: func [...] [...] Myfunc2: func [...] [...] ] MyObject2: [Myfunc1: func [...] [...] Myfunc2: func [...] [...] ] This is pretty good practice anyway. 2. For any of these functions you want a better set of reporting on, defined the with the Logged marker word: MyObject1: [Myfunc1: logged func [...] [...] Myfunc2: func [...] [...] ] MyObject2: [Myfunc1: logged func [...] [...] Myfunc2: logged func [...] [...] ] (So for some reason, I've decided not to get a better oversight on MyObject1/MyFunc2) 3. Before you make your first object call, run Volker's initialisation code: Logging MyObject1 Logging MyObject2 (This replaces the 'logged marker word with some magic). 4. To do this, you need Volker's functions, available at: (this is a bit of a jumble of payload code, test code, examples and development history. You just need the functions from the comment "control your logging here" onwards.) Thanks Volker! Sunanda.