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.


> 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
         (NIL (eval (car Prg) 1))
         (up @ @)
         (run (cdr Prg) 1) ) )

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

Reply via email to