[cffi-devel] Round trips through parse-type, unparse-type

Luís Oliveira luismbo at gmail.com
Fri May 11 07:15:47 UTC 2012


On Fri, May 11, 2012 at 4:38 AM, Liam Healy <lnp at healy.washington.dc.us> wrote:
> Ah, OK, not round trips, forget what I said about unparse-type.  My sense is
> there's repeated reparsing.  If a type was always parsed when read, and the
> parsed form is stored, would that save some reparsing?   So the type slot in
> foreign-struct-slot would not need to be parsed each time it's used.

Right, I think it would make sense for struct slots to be parsed. I
suspect that they aren't because that code predates the concept of
parsed types in CFFI, hence the FIXME.

In practice this is not a performance issue because the compiler macro
for foreign-struct-slot wil perform parsing at compile-time. Also, the
current scheme lets us pass the unparsed type to mem-ref directly. If
the type were to be parsed, we'd need a version of mem-ref that
accepts a parsed type. Shouldn't be too hard, I suppose.

-- 
Luís Oliveira
http://r42.eu/~luis/




More information about the cffi-devel mailing list