Hi Alex, wow, thanks for advice! Seems like I misunderstood (throw)
purpose. I thought that "thrown" symbols are somewhat similar to custom
exception classes in OOP languages. Actually, yeah, working with plain
strings for raising logic exception is much more convinient :)

> Hmm, sorry, I'm getting confused ;) Many variations of similar pieces of
code.
> I'm not sure exactly for which purpose you did all these tests.

I tried to find edge-case where my manual evaluated function is failing and
I'm still not sure why. OK, it does not matter actually now, because you
pointed to more simplified solution. Many thanks for your answers and your
patience. Soon I will fix this issue in pgint.l .

Best regards, Nail.

вс, 20 янв. 2019 г. в 19:40, Alexander Burger <a...@software-lab.de>:

> Hi Abel,
>
> On Sun, Jan 20, 2019 at 02:40:58PM +0300, Abel Normand wrote:
> > I did some tests and I am feeling confused atm.
> > ...
> > (de pg-trans X
> >    (run X 1) )
>
> So 'pg-trans' is equivalent to plain 'run'.
>
>
> > (de execute-eval @
> >    (mapcar eval (rest)) )
>
> This function evaluates its arguments twice. It is called after *all*
> arguments
> are evaluated and are available via (next), (rest) etc. It then builds a
> list of
> all these results with (rest), then maps over this list 'eval'uating the
> values
> a second time.
>
> Thus,
>
>    > [execute-eval
>    >    '(assert-throws 'myerr
>    >        (pg-trans (myerr-fun)) )
>
> such a value after the first evaluation is the list
>
>    (assert-throws 'myerr (pg-trans (myerr-fun)))
>
> which upon second evaluation executes (myerr-fun).
>
>
> > (de execute-run X
> >    (run X 1) )
>
> 'execute-run' is a plain 'run' again.
>
>
> Hmm, sorry, I'm getting confused ;) Many variations of similar pieces of
> code.
> I'm not sure exactly for which purpose you did all these tests.
>
>
> > So its seems like unevaluated fargs always keep track of their
> environment
> > and work as intended.
>
> Which part of them did you suspect not to work as intended?
>
>
> > Then I do not understand my issue in tests of pgint.l in one specific
> case
> > when I have to test exception thrown inside of (pg-trans). When I write
> > code that *will* throw and exception and I run it outside of
> > aw/picolisp-unit (execute) function it is catched and treated as
> intended.
> > But when I run corrupted (pg-trans ...) *inside* of (execute) function it
> > stops with "pg-db-err -- Tag not found".
>
> I'm lost a bit where exactly it went wrong. But the reason must surely be
> a case
> where a (throw 'pg-db-err) is done outside a matching 'catch' environment

Reply via email to