GNU bug report logs - #11198
serializing structs (prefabs)

Previous Next

Package: guile;

Reported by: Klaus Stehle <klaus.stehle <at> uni-tuebingen.de>

Date: Sat, 7 Apr 2012 20:18:02 UTC

Severity: wishlist

Full log


View this message in rfc822 format

From: Andy Wingo <wingo <at> pobox.com>
To: guile-devel <guile-devel <at> gnu.org>
Cc: 11198 <at> debbugs.gnu.org
Subject: bug#11198: prefab structs in guile
Date: Thu, 05 Jul 2012 10:00:17 +0200
Hi,

We should think about supporting prefab structs in Guile.  For more
details, see:

  http://docs.racket-lang.org/guide/define-struct.html?q=prefab#%28part._prefab-struct%29
  http://docs.racket-lang.org/reference/structures.html?q=record&q=structs&q=records#(tech._prefab)

The reason is that sometimes you want to allow structures to be
serialized (to Scheme or into object code) and read back in.  See bug
11198 for an example.

I don't have time for this currently, but here's one plan on how you
would do it.

  You would create a new Scheme module, (ice-9 prefab) or
something.  It would contain a map from (name, number of fields) ->
record type descriptor.  (We don't have #:mutable, #:auto, or
supertypes; these would be separate projects.)

  Then you would modify the reader to call out to (ice-9 prefab) with
the list after #s, e.g. the (foo ...) in #s(foo ...).  (ice-9 prefab)
would return the record, creating the RTD if needed.

  You also modify the printer.

  You also modify SRFI-9's define-record-type to recognize #:prefab, or
some other name.

  You also add code to the glil->assembly compiler to recognize prefab
structs, and you add an opcode to look up a prefab struct RTD.

I think that would be it.

Anyone interested?

Andy
-- 
http://wingolog.org/




This bug report was last modified 12 years and 202 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.