[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Two more bugs




On Tuesday, August 6, 2002, at 08:08  PM, Neel Krishnaswami wrote:

>
> Two more segfaults that probably shouldn't:
>
> #2:
>   goo/user 0<= (df foo (x|...) x)
>   goo/user 0=> #{Met foo ()}
>   goo/user 0<= (foo 1 2 3)

Known bug.
The optionals object created by "..." refers to the variables on the 
stack. Keeping a reference after your stack frame is gone will blow up. 
Why is this done? Performance, mainly.

Eventually, the compiler should get smart enough to analyze the code and 
transform the ... into a real object when necessary, but that isn't 
really a priority. Performance of this feature is important, as the 
dispatcher uses it. Copying the arguments around multiple times to do a 
dispatch causes a large slowdown.

Workaround: use (as <tup> x) if you need to store a copy after your 
function exits. You can see a few cases in the GOO code where this is 
necessary, e.g. curry.
James