Created
June 20, 2024 17:10
-
-
Save metaleap/1909b8fc467b90e9376ee4ed7cb46f0b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import :std/sugar | |
:std/text/json) | |
(defsyntax defcls | |
(syntax-rules () | |
((defclas $typename ($fields ...) $ctor-name) | |
(begin | |
(defclass $type-name ($fields ...) constructor: $ctor-name) | |
(defmethod {$ctor-name $type-name} | |
(lambda (this msg) | |
(displayln "ctor sez" msg))) | |
)) | |
)) | |
(defcls MyClass (f1 f2 f3) :init!) | |
(def (main . args) | |
(def inst (make-MyClass "hallo")) | |
(set! (MyClass-f1 inst) "hola") | |
(displayln (MyClass-f1 inst))) | |
(main) |
Author
metaleap
commented
Jun 20, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment