Re: make-vtable

2007-03-06 Thread Ludovic Courtès
Hi, Kevin Ryde <[EMAIL PROTECTED]> writes: > I'm looking at the code below for my new `make-vtable'. I'm still not > completely convinced it's a great idea, but it does at least find a > use in stacks.c, so it can't be all bad! I find it nice and useful,

Re: make-vtable

2007-03-05 Thread Kevin Ryde
I'm looking at the code below for my new `make-vtable'. I'm still not completely convinced it's a great idea, but it does at least find a use in stacks.c, so it can't be all bad! --- struct.c.~1.111.2.6.~ 2007-03-06 11:19:49.0 +1100 +++ struct.c 2007-03-06

Re: make-vtable

2007-02-19 Thread Ludovic Courtès
Hi, Kevin Ryde <[EMAIL PROTECTED]> writes: > Neil Jerram <[EMAIL PROTECTED]> writes: >> >> That's a fair point, but IMO Kevin's doc layout allows for it by >> putting the vtable-vtable stuff last. > > It's last because it's the most brain twisting :). I think it's the right term. ;-) I agree w

Re: make-vtable

2007-02-18 Thread Neil Jerram
Kevin Ryde <[EMAIL PROTECTED]> writes: > Is the "ball" example your code? It looks fairly typical (a "colour" > field in the vtable which is a constant), if the few words introducing > it give the right sense of what it's meant to be about. No, not mine. I didn't recall seeing it before, so I a

Re: make-vtable

2007-02-18 Thread Kevin Ryde
Neil Jerram <[EMAIL PROTECTED]> writes: > > That's a fair point, but IMO Kevin's doc layout allows for it by > putting the vtable-vtable stuff last. It's last because it's the most brain twisting :). Is the "ball" example your code? It looks fairly typical (a "colour" field in the vtable which i

Re: make-vtable

2007-02-18 Thread Neil Jerram
[EMAIL PROTECTED] (Ludovic Courtès) writes: > Right, but a "metaclass" is the class of class, i.e., a class (IOW, a > metaclass is an instance of or a sub-class thereof). So that's > really two levels. That's true, but then it's also true that a class is an instance - so you could say that's ju

Re: make-vtable

2007-02-18 Thread Ludovic Courtès
Hi, Neil Jerram <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] (Ludovic Courtès) writes: > >> More generally, a three-level architecture like the one you suggest >> would look fishy. For instance, GOOPS and other CLOS derivatives have >> and , representing respectively the "base" and "meta" >>

Re: make-vtable

2007-02-18 Thread Neil Jerram
[EMAIL PROTECTED] (Ludovic Courtès) writes: > More generally, a three-level architecture like the one you suggest > would look fishy. For instance, GOOPS and other CLOS derivatives have > and , representing respectively the "base" and "meta" > levels, but they have no need for , or > some such.

Re: make-vtable

2007-02-16 Thread Ludovic Courtès
as long as you don't want any extra fields in the vtable (which > is true for scm_stack_type). I thought of that for my make-vtable > func, > > (define make-vtable > (let ((vtable-vtable #f)) > (lambda (fields tail-size . print) > (or vtable-

Re: make-vtable

2007-02-15 Thread Kevin Ryde
;, `struct-vtable' > would terminate the "reflective tower" (i.e., its vtable is itself). Yes, as long as you don't want any extra fields in the vtable (which is true for scm_stack_type). I thought of that for my make-vtable func, (define make-vtable (let ((vtable-

Re: make-vtable

2007-02-15 Thread Ludovic Courtès
terminate the "reflective tower" (i.e., its vtable is itself). Actually, such a `struct-vtable' stealthily appears in `make-vtable-vtable', under the name of REQUIRED_VTABLE_FIELDS: We could really have a `struct-vtable' whose layout is REQUIRED_VTABLE_FIELDS and the

Re: make-vtable

2007-02-14 Thread Kevin Ryde
levels, but they have no need for , or > some such. The closest I've got to imagining it is that make-vtable-vtable creates a root, a vtable whose parent vtable is itself. (What I'm not sure if it's supposed to be the root of a whole heirarchy, or just of two levels, if you kn

Re: make-vtable

2007-02-14 Thread Ludovic Courtès
rmal"). I'm not sure the indirection in `scm_init_stacks ()' is needed since it uses STACK_LAYOUT for both VTABLE and SCM_STACK_TYPE, and `make-struct' doesn't look at the vtable's vtable anyway (when creating instances of SCM_STACK_TYPE). > Perhaps we have an expert lur

Re: make-vtable

2007-02-13 Thread Kevin Ryde
[EMAIL PROTECTED] (Ludovic Courtès) writes: > > (let* ((vtable (make-vtable-vtable "pr" 0)) > (s1 (make-struct vtable 0 "hello")) > (s2 (make-struct vtable 0 "hello"))) >;; S1 and S2 are both "regular&

Re: make-vtable

2007-02-13 Thread Ludovic Courtès
rection: in classic reflective OO terms, `make-vtable-vtable' returns a "class" object which `make-struct' can then use to return regular (i.e., non-class) objects. In particular, this example (from `structs.test') works: (let* ((vtable (make-vtable-vtable "pr&quo

make-vtable

2007-02-12 Thread Kevin Ryde
. 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