[Top][All Lists]

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

Re: [Chicken-hackers] [PATCH] [CHICKEN 5] Change numerics representation

From: felix . winkelmann
Subject: Re: [Chicken-hackers] [PATCH] [CHICKEN 5] Change numerics representations
Date: Tue, 09 Aug 2016 20:58:14 +0200

> My main concern, after giving it some more thought, is that you can't
> easily make the FFI check the pointer type, unless you enforce that
> pointer tags are somehow either compile-time constants, or also stored
> in some global that's directly accessible to the FFI.  There should be
> a low-overhead and simple type check, which is also statically
> expressible, otherwise one might just as well define their own
> foreign type with conversion procedures, so, a record type with the
> pointer inside it like this [...]

You could use a simple global counter for tags and map this numeric tag to
something else (like symbols) through a global table. The real meaning
of the tag is only interesting in Scheme code (introspection, printing, error
messages), but not on the FFI-level. The one situation where this gets
complicated is when serializing, but then you could serialize the
full tag value, together with the pointer (whether serializiing pointers
is useful or not is another question, of course, but it may be needed


reply via email to

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