On 6/18/07, Dan Amelang <[EMAIL PROTECTED]> wrote:
>
> Basically, I just want to walk one step up the clone family...
> Besides poking around in memory, I don't see a way to do this
> in jolt.
Here's a version of "super" I just coded up that uses this
memory-poking approach to get at the base. Comments welcome.
(syntax super
(lambda (node compiler)
(let ((selector [node at: '1])
(args [node copyFrom: '2]))
`(let ((base-vtable (long@ (+ [self _vtable] 8)))
(__closure [[base-vtable lookup: ,selector] value]))
((long@ __closure) __closure self self ,@args)))))
(define [SubClass print: this]
(super 'print: "something else"))
I know it could use some error checking, and I make an assumption that
size_t and oop are 4 bytes wide (which is not portable). Besides that,
I think it'll do.
Oh, and if we had something like "thisContext", I wouldn't even need
the "selector" parameter to super, as it could be extracted from
thisContext. But I'm sure Ian's got more important things to do :)
Dan
_______________________________________________
fonc mailing list
[email protected]
http://vpri.org/mailman/listinfo/fonc