guile-devel
[Top][All Lists]
Advanced

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

Re: records as s-expressions


From: Neil Jerram
Subject: Re: records as s-expressions
Date: 17 Oct 2003 07:43:06 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

>>>>> "Rob" == Rob Browning <address@hidden> writes:

    Rob> Thamer Al-Harbash <address@hidden> writes:
    >> Would it be reasonable to just use (read-hash-extend) to hook
    >> into the existing reader, and as well as modify existing
    >> boot-9.scm code cause records to (display) as #S(...)?
    >> 
    >> If I went with the SRFI-10 solution I'd be implementing this as a
    >> (record-serialize) (record-unserialize) which seem a bit less
    >> Schemeish to me.

    Rob> I think I might rather go with the SRFI since that means any
    Rob> records written have a much greater possibility of being able
    Rob> to be parsed by other schemes, [...]

I agree with Rob.  Remember that the only cleverness required here is
to construct the reread record properly at _read_ time; if it was OK
for construction to be delayed until evaluation, then records could be
printed simply as whatever Scheme functional expression is needed to
create a record (e.g. `(record-constructor <type> <args>)).

So the problem is construction at read time, and this is exactly what
SRFI-10 is designed to do.  As regards convenience of usage, I think
the details of the mechanism can all be hidden from the user inside
`write', either using GOOPS, or by hacking the C code for write.  I
don't see a need for explicit record-serialize/record-unserialize
calls.

Best regards,
        Neil





reply via email to

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