Created
March 11, 2015 11:50
-
-
Save xuchunyang/f4964e57ba90801da77b to your computer and use it in GitHub Desktop.
elisp-learn-eieio-1.el
This file contains 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
(defclass record () ; No superclasses | |
((name :initarg :name | |
:initform "" | |
:type string | |
:custom string | |
:documentation "The name of a person.") | |
(birthday :initarg :birthday | |
:initform "Jan 1, 1970" | |
:custom string | |
:type string | |
:documentation "The person's birthday.") | |
(phone :initarg :phone | |
:initform "" | |
:documentation "Phone number.")) | |
"A single record for tracking pepole I know.") | |
(setq rec (record "Eric" :name "Eric" :birthday "June" :phone "1234-2222")) | |
(defmethod call-record ((rec record) &optional scriptname) | |
"Dial the phone for the record REC. | |
Execute the program SCRIPTNAME to dial the phone." | |
(message "Dialing the phone for %s" (oref rec name))) | |
(call-record rec) | |
(call-record emacs-version) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment