Re: Keyword support in SRFI 198
Lassi Kortela 02 Aug 2020 06:58 UTC
> (make-foreign-error
> :set 'errno
> :code 'ETOOMANYREFS
> :message "Too many references: can't splice")
(foreign-error-ref ferr 'code) => 'ETOOMANYREFS
The usage of keywords vs symbols in the above is equivalent to the
following Common Lisp idioms:
(define-condition foreign-error/errno (error)
((set :initarg :set)
(code :initarg :code)
(message :initarg :message)))
;; make-instance (akin to make-foreign-error) uses keywords:
(make-instance
'foreign-error/errno
:set 'errno
:code 'ETOOMANYREFS
:message "Too many references: can't splice")
;; slot-value (akin to foreign-error-ref) uses symbols:
(slot-value e 'message) => "Too many references: can't splice"