Skip to content

Instantly share code, notes, and snippets.

@iratqq
Created July 22, 2009 15:59
Show Gist options
  • Save iratqq/152074 to your computer and use it in GitHub Desktop.
Save iratqq/152074 to your computer and use it in GitHub Desktop.
(require "wlos.scm")
(define-class <hello> object
'((foo #f))
'(hello!
hello?
bar))
(class-set-method! <hello> hello!
(lambda (self)
(<hello>-set-foo! self #t)
(print "hello!")))
(class-set-method! <hello> hello?
(lambda (self)
(<hello>-foo self)))
(class-set-method! <hello> bar
(lambda (self)
(print "bar")))
(define hello-object (make-<hello> #f))
(print (<hello>-hello? hello-object))
(<hello>-hello! hello-object)
(print (<hello>-hello? hello-object))
(define-class <hello2> <hello>
'()
'(bar
baz))
(class-set-method! <hello2> hello!
(lambda (self)
(<hello2>-set-foo! self #f)
(print "hello2!")))
(class-set-method! <hello2> bar
(lambda (self)
(<hello>-hello! self)
(print "bar2")))
(class-set-method! <hello2> baz
(lambda (self)
(<hello2>-hello! self)
(print "baz")))
(define hello2-object (make-<hello2> #t))
(print (<hello2>-hello? hello2-object))
(<hello2>-bar hello2-object)
(<hello2>-baz hello2-object)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment