Re: Location of an error

2015-01-26 Thread Christophe Gragnic
On Sat, Jan 24, 2015 at 9:07 AM, Alexander Burger a...@software-lab.de wrote:
 Now when the code of the user/dev contains a mistake, the location
 of the error is always at the line where `my_while` is called and not in its
 body at the line of the mistake.

 I'm not sure I understand the problem.

I thought it would have been possible to be more precise.

 […]
 pointer is), not necessarily the expression which caused the error.

OK then. I'm in the process of changing my main commands (or functions)
from S-expr to F-expr. If the need comes, I may try to display the whole faulty
call with an indication of the location of the error. It should be possible

Re: Location of an error

2015-01-24 Thread Alexander Burger
Hi Christophe,

 I emulated a «while» loop with a function defined with a `de`, say `my_while`.
 It has a body that allows a user defined body (the user is a developer!)
 to be executed, thanks to 'run.

OK.

 Now when the code of the user/dev contains a mistake, the location
 of the error is always at the line where `my_while` is called and not in its
 body at the line of the mistake.

I'm not sure I understand the problem.

A PicoLisp error stops at the location of the error, which is the
expression being executed. The error handler displays that expression,
if possible. There is no line involved.

If the error happens while a file is being interpreted (i.e. with
'load'), then in addition to the above the file and line number is
printed. This is the top level location (i.e. where the current file
pointer is), not necessarily the expression which caused the error.


BTW, a definition of 'while' fully compatible with the built-in
would be:

   (de while Prg
  (loop
 (NIL (eval (car Prg) 1))
 (up @ @)
 (run (cdr Prg) 1) ) )

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Location of an error

2015-01-23 Thread Christophe Gragnic
Hi all,

I emulated a «while» loop with a function defined with a `de`, say `my_while`.
It has a body that allows a user defined body (the user is a developer!)
to be executed, thanks to 'run.
Now when the code of the user/dev contains a mistake, the location
of the error is always at the line where `my_while` is called and not in its
body at the line of the mistake.
I tried to call 'run with an offset (vague memories of Tcl), but no luck.
Is there a way to be more accurate concerning this ?


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe