This is the mail archive of the guile@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: In the search of heap enlightenment...


Mikael Djurfeldt <mdj@nada.kth.se> writes:

> Marius Vollmer <mvo@zagadka.ping.de> writes:
> 
> > Why, just call the four fields car, cbr, ccr, cdr. ;-)
> 
> An excellent idea!  :-)

Alists could be really funky :')
 
> Actually, I wonder if it is necessary to have a name for it.
> 
> We're not often going to build list structures using both the CAR and
> the CDR and the two extra fields simultaneously.
> 
> Also, I think we should use this feature internally only.  I don't
> think it should be visible for the user.
>
> So, I don't see any problem with accessing all four fields in cell x with
> 
>   SCM_CELL (x)[i]
> 
> where i = 0 .. 3 and SCM_CAR and SCM_CDR retaining their current meaning.
> 
> This will generalize naturally if we decide to add further cell types.

I'd like to wrap these up in macros at the gc, though, as a just in
case sort of thing, so that a change to the gc won't break everything
(it shouldn't change, but if I could see into the future, I'd be on tv
with Dionne Warwick :). How about SCM_CELL_WORD(x, word) (or
SCM_CELL_FIELD)? It can easily expand into SCM_CELL (x)[word], and
would also allow a debugging version that checks if cell actually has
that word.
 
-- 
Greg