This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: SCM_NEWCELL{2}?
- To: Dirk Herrmann <dirk at ida dot ing dot tu-bs dot de>
- Subject: Re: SCM_NEWCELL{2}?
- From: Michael Livshin <mlivshin at bigfoot dot com>
- Date: 27 Mar 2000 16:32:04 +0200
- Cc: Guile Mailing List <guile at sourceware dot cygnus dot com>
- Organization: who? me?
- References: <Pine.LNX.4.21.0003271542110.6315-100000@marvin.ida.ing.tu-bs.de>
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.