Re: Pico/Ersatz diffs: chain, link, yoke

2014-07-17 Thread Jon Kleiser
Hi Alex,

Since you have inserted checks for ‘Env.make’, I suggest you fix this one also:

When I do this in ersatz …

(setq X 99)
(val X)

… then I get java.lang.NullPointerException, but in real PicoLisp I get 99 -- 
Variable expected”.

/Jon (with a new email address, but old one will stay valid)

On 25. Jun, 2014, at 18:17, Alexander Burger a...@software-lab.de wrote:

 Hi all,
 
 thanks for the feedback!
 
 
 You would be mad to use Erzats for performance anyway, so I'd wish for
 correctness or similarity. It would also serve as a documentation of
 what it takes to implement a full PicoLisp. Sort of a portable spec.
 
 OK, but it is also a bit mad to check for something we know it will be
 checked immediately after that again. And we can't tell the JVM don't
 check that, we've done it already.
 
 Samuel's proposal for 'Control' is perhaps not useful here, as it is for
 catch/throw only.
 
 We could catch the NullPointerException and then throw an error. But
 that's also rather ugly, and setting up the handler for that is probably
 more expensive than just checking the value.
 
 So I inserted checks for 'Env.make' and the corresponding error messages
 into ersatz/fun.src.
 
 ♪♫ Alex

PԔ � j)mX�����zV�u�.n7�

Re: Pico/Ersatz diffs: chain, link, yoke

2014-07-17 Thread Alexander Burger
Hi Jon,

 Since you have inserted checks for ‘Env.make’, I suggest you fix this one 
 also:
 
 When I do this in ersatz …
 
 (setq X 99)
 (val X)
 
 … then I get java.lang.NullPointerException, but in real PicoLisp I get 99 
 -- Variable expected”.

See? This is exactly the reason why I didn't want to fix it!

In fact I did already regret that I did it.

There are probably hundreds of such cases. You need to clobber the whole
interpreter with such checks, without any gain in functionality but just
another error message. And I don't want to do that, for reasons I tried
to explain also in the previous mail.

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


Re: Pico/Ersatz diffs: chain, link, yoke

2014-06-25 Thread Alexander Burger
Hi Jon,

 If you in normal PicoLisp do any of the following, without any use of ‘make' …
 (chain (1 2 3))
 (link 1 2 3)
 (yoke 1 2 3)
 … then you’ll get a Not making” error message.
 
 However, if you do the same with Ersatz, you’ll get a
 java.lang.NullPointerException for ‘chain’ and ‘link’.

You are right, this is a disputable issue.

In fact, I deliberately omitted the runtime checks for a 'make'
environment in ErsatzLisp, because the JVM already does such a check (a
NullPointerException is also an error message, albeit a rather unprecise
one).

If you take a closer look, you see that most explicit error checks which
exist in PicoLisp are omitted in ErsatzLisp. For simplicity, brevity and
performance.


 For (yoke 1 2 3) you’ll get 3

This is indeed unaesthetic, yes. At least here it is needed.

We could easily add proper error messages to ErsatzLisp too, checking
for non-NULL 'Env.Make' and 'Env.Yoke'.

How is the general opinion on that?
♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Pico/Ersatz diffs: chain, link, yoke

2014-06-25 Thread Alexander Burger
Hi all,

thanks for the feedback!


 You would be mad to use Erzats for performance anyway, so I'd wish for
 correctness or similarity. It would also serve as a documentation of
 what it takes to implement a full PicoLisp. Sort of a portable spec.

OK, but it is also a bit mad to check for something we know it will be
checked immediately after that again. And we can't tell the JVM don't
check that, we've done it already.

Samuel's proposal for 'Control' is perhaps not useful here, as it is for
catch/throw only.

We could catch the NullPointerException and then throw an error. But
that's also rather ugly, and setting up the handler for that is probably
more expensive than just checking the value.

So I inserted checks for 'Env.make' and the corresponding error messages
into ersatz/fun.src.

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