Then I wrote test code like this;
(import (rnrs) (srfi :42)) (apply values (list-ec (: x 150000) (* x x)))Well, it just applies a list contains 150000 elements to values. I don't know why I put such a huge number but it revealed a bug in Sagittarius. (could be mosh as well).
The problem is really simple. Sagittarius' compiler compiles apply procedure as a builtin instruction APPLY. This instruction pushes given arguments to stack, however it does not check whether or not stack overflows and current maximum stack size is 10000.Yes, it breaks something I don't want to.
The solution can be 2 ways. The easiest way is check arguments count and if it's more than maximum then raises an error. The not so easy way is change the behaviour of APPLY a bit.
The first one is a bit awkward even if nobody applies such huge number of arguments. So I will do the latter one.
I don't know when I can say it's stable...