Error handling in uLisp


#1

@johnsondavies, hi, take a look at this commit where I implemented unwind-protect, ignore-errors, and errors. Because uLisp doesn’t have multiple return values, I made ignore-errors return nothing when an error occurs within.

Also it’d be great if the special forms would signal error in all cases of malformed forms instead of failing/accessing invalid memory:

(dotimes ())
((lambda))
(let)
(let*)
(with-output-to-string)

and so on.

Perhaps, I could look into that if I find the time for that; however, contributing to this project isn’t easy, especially as you keep separate code bases for different families of boards. I understand the motivation of single ino files, well, I’ll think about this and then share my thoughts about what could be done for easier contributing and keeping different ino files in sync.


#2

Ok, I can see that mere restoration of GCStack isn’t enough and when I do:

(unwind-protect (/ 0) (format t "Blah"))

it leaks memory. Can you tell me what I’ve missed out? Probably something to do with marking.


#3

@Goheeca thanks for pointing out the problem with malformed special forms. I’ll fix that in the next release.

I’d welcome your suggestions about contributing to the project. I generate the code bases for each family from a multi-family code base, via a Lisp preprocessor program. So one option is for you to contribute to one of the families; I can then merge that into the multi-family code base so it gets applied to all families.


#4

I’ll take a look at unwind-protect.


#5

I’ve fixed it, I forgot to reset GCStack to NULL before the next longjmp, well, there were more problems and it worked deceivingly well, but now it should be fine. Feel free to incorporate it into uLisp.


#6

Thanks! I look forward to trying it out.