You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the Recurly LFE client, we've had to create a modified version of the defelem macro in order to not have unexpected collisions with function names. So when we use Exemplar to create XML tags, for a Recurly account, we're not stomping on a function called (account ...) (and we're not asking a user of the rcrly library to do that). We do this via a "prefix" that is pre-pended to the XML-generating functions, but which is not reflected in the XML output:
Here's the macro we created:
(defmacrodefelem arg
"This is a custom defelem macro based on the one in Examplar here: * https://github.com/lfex/exemplar/blob/master/include/macros.lfe The macro below differs in that is expects a prefix when defining the element and then when calling it -- something designeed to avoid namespace collisions with the relatively general names of the XML elements defined by the Recurly API."
(let* ((prefix-and-tag (atom_to_list (car arg)))
(`(,prefix ,tag) (string:tokens prefix-and-tag "/")))
`(progn
(defun,(list_to_atom (++ prefix "/" tag)) ()
(exemplar-xml:make-xml ,tag))
(defun,(list_to_atom (++ prefix "/" tag)) (content)
(exemplar-xml:make-xml ,tag content))
(defun,(list_to_atom (++ prefix "/" tag)) (attrs content)
(exemplar-xml:make-xml ,tag attrs content)))))
In the Recurly LFE client, we've had to create a modified version of the
defelem
macro in order to not have unexpected collisions with function names. So when we use Exemplar to create XML tags, for a Recurly account, we're not stomping on a function called(account ...)
(and we're not asking a user of the rcrly library to do that). We do this via a "prefix" that is pre-pended to the XML-generating functions, but which is not reflected in the XML output:Here's the macro we created:
Here are some definitions:
These allow the following usage:
The text was updated successfully, but these errors were encountered: