guile-devel
[Top][All Lists]
Advanced

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

Re: The relationship between SCM and scm_t_bits.


From: Paul Jarc
Subject: Re: The relationship between SCM and scm_t_bits.
Date: Tue, 04 May 2004 14:35:57 -0400
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (gnu/linux)

Marius Vollmer <address@hidden> wrote:
> SCM_DEBUG_TYPING_STRICTNESS == 2 is not meant for production code (I
> have to review it anyway, there has been a bug report about it not
> working at all, I think), so when compiling with that setting, the
> performance argument doesn't count.

What I'm saying is that (ISTM) we might be able to get maximum
type-safety and still have zero run-time conversion cost.  Isn't that
the ideal?

But actually, SCM_DEBUG_TYPING_STRICTNESS == 1 looks like it's just as
safe as 2 anyway.  (I think it would be nice to have SCM_UNPACK
type-check its argument as SCM_PACK does; let the caller explicitly
cast to scm_t_bits to silence the warning.)

> A given location is always only accessed as one type.

If that's true, then a union containing SCM and scm_t_bits would give
us standard-conformance.

> We already aim to be -fstrict-aliasing safe

Ok, good.

>> What do we gain here over your previous use-SCM-everywhere
>> suggestion?
>
> We would have to remove SCM_CELL_WORD_LOC from the API.

Is there much code outside of Guile itself using that?  I guess Guile
itself will always need something like scm_t_bits to check type tags,
but I wonder how useful WORD_LOC is for other code.

> When we can only have one type of pointer (either SCM* and
> scm_t_bits*), I would want to have pointers to SCM since SCM is the
> type that the users works with.  That would mean that heap words are
> of type SCM.

I agree.

> That then also means that SCM_PACK would be used to store 'invalid'
> values into a SCM and can no longer be used to mark places where only
> valid SCM values should appear.  Maybe we should have a new
> SCM_PACK_BITS for this, or maybe not.

SCM_MAKINUM? :)  Or do we need the full range?  More precisely, do we
need the full range and zero-cost conversion simultaneously?  Even
more precisely, do we need that in the API, for code outside of Guile
itself?

> My instincts tell me to just remove scm_t_bits from the public API
> completely, but that is rather drastic, maybe for 1.10...

Yes, if it's to be done, there should certinaly be a significant
deprecation period to give people time to adapt.


paul




reply via email to

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