Автор | Сообщение |
rawlik
8 сообщений |
#2783 2010-08-28 16:21 GMT+3 часа(ов) |
В стандарте написано, что функция slot-value применима к "Объектам"
Применим ли макрос with-slots и функция slot-value к структурам? в CLISP и SBCL такой код прокатывает: (defstruct aaa () (defparameter test (make-aaa )) TEST (slot-value test 'a) 0 (slot-value test 'b) 1 Насколько такой код переносим, и что на этот счет говортит стандарт ? |
|
megamanx
307 сообщений |
#2785 2010-08-29 01:41 GMT+3 часа(ов) |
там исчо
Each slot-description in a defstruct form may specify one or more slot-options. A slot-option consists of a pair of a keyword and a value (which is not a form to be evaluated, but the value itself). Акромя всего Each class that corresponds to a predefined Common Lisp type specifier can be implemented in one of three ways, at the discretion of each implementation. It can be a standard class (of the kind defined by defclass), a structure class (defined by defstruct), or a built-in class (implemented in a special, non-extensible way). В руководстве к описанию структуры также написано, что создаётся instance of ... и автоматически к этому конструктор и аксессор имхо, переносимо) |
|
I wish I'd made you angry earlier
|
|
antares0
185 сообщений |
#2786 2010-08-29 10:59 GMT+3 часа(ов) |
Цитата Не переносимо (не имхо). Насчет применимости к "объектам", дочитать до конца. |
|
rawlik
8 сообщений |
#2788 2010-08-30 05:14 GMT+3 часа(ов) |
Цитата
Цитата Т.е. поведение CLISP и SBCL явно "Implementation dependent". До конца дочитал, вот: Цитата Спасибо. |
|