Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Scheme by SinDoc ( 15 years ago )
(define-for-syntax (process-members members)
(deftable members-map)
(syntax-case members ()
(((public static var-name var-value))
(members-map-add+ 'public-static-fields
reference-to-the-matched-syntax-object))
,,,
(define-syntax (defclass stx)
(syntax-case stx ()
((defclass name parent members ...)
(quasisyntax
(define (name)
(define meta '())
(unsyntax
(process-members #'(members ...))))))))
;;; Example input form
(defclass NCard Object
;; Public (Static) Fields
(public name)
(public static number-of-cards 0)
;; Private (Static) Fields
(private status)
(private static nice-cards 10)
;; Public (Static) Methods
(public play ()
(show "Play the card"))
(public static all-names-as-list ()
(show "Put the name of all cards in a list"))
;; Private (Static) Methods
(private check ()
(show "Checks stuff"))
(private static all-statuses-as-list ()
(show "Put the status of all cards in a list"))
)
Revise this Paste