-
Notifications
You must be signed in to change notification settings - Fork 2
/
macros.scm
26 lines (21 loc) · 912 Bytes
/
macros.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
;;; -*- Mode: Scheme; scheme48-package: soosy-macros -*-
(define-syntax define-class
(syntax-rules ()
((define-class class-name superclass (inst-vars ...))
(define class-name (make-class 'class-name superclass '(inst-vars ...))))))
(define-syntax define-method
(syntax-rules ()
((define-method class (operation object arguments ...) body0 body ...)
(class-method-define class 'operation
(lambda (object arguments ...) body0 body ...)))
((define-method class operation method)
(class-method-define class 'operation method))))
(define-syntax ==>
(syntax-rules ()
((==> object operation argument ...)
(send object 'operation argument ...))))
(define-syntax usual==>
(syntax-rules ()
((==> object operation argument ...)
(send-usual object 'operation argument ...))))
(define-syntax with-instance-variables with-instance-variables*)