|
|
|
|
home / intro / faq / tutorial / manual / models / download / people / about |
||
| fields (under construction) |
|
This page is a stub.
The dot character (.) is used to access fields of an object.
Field syntax is implemented as a reader macro, which expands to a FLD form:
|
O.F =R=> (FLD O :F) O.(F) =R=> (FLD O :F) O.(F A1 A2...) =R=> (FLD O :F A1 A2 ...) O.,F =R=> (FLD O F) ; field F is determined dynamically O.(,F A1 A2) =R=> (FLD O F A1 A2 ...) |
FLD names a generic function:
| (defgeneric fld (object field &rest args)) |
Each kind of field (identity, property, method) is implemented as a field method. DEFIELD should be used to define new FLD methods. DEFIELD implicitly creates a FLD method by macroexpansion:
|
(defield X.Y (A) ...code...) =M=> ... (defmethod fld ((object X) (field (eql :Y)) &rest args) (destructuring-bind (A) args ...code...) |
Default fields are written using the ?field field:
|
(defield X.?FIELD (A) ...this code will run whenever a specific FLD method is not present...) |