bug-guile
[Top][All Lists]
Advanced

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

bug#11198: prefab structs in guile


From: Andy Wingo
Subject: bug#11198: prefab structs in guile
Date: Thu, 05 Jul 2012 10:00:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

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/





reply via email to

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