This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: SCM_NEWCELL{2}?


Dirk Herrmann <dirk@ida.ing.tu-bs.de> writes:

> The current definition:
>
> ***            scm_freelist = SCM_CDR (scm_freelist);\
> ***            SCM_SETCAR (_into, scm_tc16_allocated); \
> 
> becomes:
> 
> ***            scm_freelist = SCM_CELL_OBJECT_1 (scm_freelist);\
> ***            SCM_SET_CELL_TYPE (_into, scm_tc16_allocated); \
> 
> The reason is, that neither the cells on the freelist from valid scheme
> pairs (i. e. SCM_CONSP is wrong), nor is the newly allocated cell a valid
> scheme cell (same reason).  Thus, accessing cells from the freelist with
> SCM_CDR is not appropriate, nor is SCM_SETCAR appropriate to access the
> allocated cell.  The other SCM_NEWCELL definitions would have to be
> changed accordingly.
> 
> Please note that the resulting code will not be different (I hope
> :-).  It's just the type strictness that (I think) will be improved.

and the clarity will be impacted, IMHO.  I find it convenient to view
freelist as a list.

OTOH, you could devise special macros to access the freelist, like
SCM_FREELIST_CDR &c, and then I, for one, would be happy.

-- 
Make sure your code does nothing gracefully.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]