guile-devel
[Top][All Lists]
Advanced

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

Re: stumped by scm_car/scm_cdr


From: Han-Wen Nienhuys
Subject: Re: stumped by scm_car/scm_cdr
Date: Fri, 8 Oct 2004 00:51:23 +0200

address@hidden writes:
> Han-Wen Nienhuys <address@hidden> writes:
> 
> > I tried to remove all fishy looking places where SCM_C[AD]R were used,
> > and now it seems to work OK. You might want to consider just doing
> > abort() or a something similar as a standard.
> 
> That would not fit SCM_CAR, SCM_CDR etc well.  These macros are there
> for code that knows what it does and wants to do it fast.  You can use
> SCM_DEBUG_CELL_ACCESSES to have them do some checks, however.  These
> checks will only assert that you access a cell, not whether that cell
> represents a pair.
> 
> In general Guile only aborts when there is no other way, for example
> when it has run out of memory or when the error reporting mechanism
> itself fails.

Ok. In that case, we should figure out why this could hang.

One thing that is fishy, is the fact that  

        void
        scm_wrong_type_arg_msg 

tries to call scm_list_2(), which will fail if GC is active.

I've added a check to scm_cell/scm_double_cell that calls abort() if
GC is running.

> So, we might talk about whether SCM_CAR and SCM_CDR should abort when
> passed a non-pair, or whether they should signal an error; or whether
> they should check that they are passed a cell.

No, I just don't want GUILE to ever hang. An error, ungraceful or not,
is always preferable. This probably fixes the cause, but wouldn't it
be better to check the thread handling as well? I guess that calling
scm_cell from GC causes a problem, because GC will (again) put all
threads to sleep.


-- 

 Han-Wen Nienhuys   |   address@hidden   |   http://www.xs4all.nl/~hanwen 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]