[Top][All Lists]

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


From: Kevin Ryde
Subject: make-vtable
Date: Tue, 13 Feb 2007 08:13:38 +1100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

I made a bit of a start trying to improve the structures section of
the manual, I always found it pretty hard to follow.  One big
stumbling block for me was vtables, but I now see if you want to make
a struct you have to make a vtable vtable, and from that a vtable, and
only then your struct.  Seems hard work for casual users, if you're
not (at first) interested in that second level of "type of type".

How about something like this to just make a vtable from fields and
optional printer func,

    (define (make-vtable fields . print)
      (apply make-struct (make-vtable-vtable "" 0) 0
             (make-struct-layout fields)

I suppose a func should be judged on whether it'd be used, but a
make-vtable like this would certainly make the manual easier reading,
since you can get started making structs just from the fields layout,
and only later that learn details of sets of related types, extra
slots in the vtable(s) for class data, etc.

reply via email to

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