Joel:

> The short answer is "you can't".  One feature of REBOL this
>  differs from most other programming languages is that the
>  distinction between "code" and "data" is not relevant.  REBOL
>  can evaluate anything, including blocks that were constructed
>  as the result of evaluating other expressions.  So, in general,
>  the concept of "source line" simply isn't meaningful.
>  
>  For example:
>  
>      a: [b:]
>      c: [2 + 2]
>      d: append a c
>      insert d first [print]
>      do d
<snip>  
>  Evaluating the above expressions constructs a new block and then
>  evaluates that block.  If an error had occurred during evaluating
>  the last expression (the last value of D), how would we have any
>  concept of "which line" was involved?

But a longer answer should be "you can't, but Rebol should". Rebol gives far 
too little away when there is an error -- maybe Carl S doesn't make stupid 
coding errors like the rest of us.

Let me modify your code to have a bug in it (it *was* correctly typed)

   a: [b:]
    c: [2 / 0]  ;; bad code: no bananas
    d: append a c
    insert d first [print]
    do d

And run it. We get:

** Math Error: Attempt to divide by zero
** Near: print b: 2 / 0

Try even finding where that is in a multi-programmer, cross-machine system of 
a few thousand lines of code. That sort of error context information puts an 
automatic brake on the size of any Rebol-based development.

Why won't (not can't) Rebol at least tell me the error line is:
    "do d"
   near
   " d: append a c
    insert d first [print]"

Better context information *is* in there somewhere -- try this: the same 
error in a VID action facet:

    
unview/all
  view layout [
  button "click me"
   [
    a: [b:]
    c: [2 / 0]
    d: append a c
    insert d first [print]
    do d
    ]
]

This fails in an easier to find way --  better context information:

** Math Error: Attempt to divide by zero
** Where: func [face value][
    a: [print b: 2 / 0]
    c: [2 / 0]
    d: append a c
    insert d first [print]
    do d
]
** Near: print b: 2 / 0


Sunanda.

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to