Skip to main content
added 7 characters in body
Source Link

When developing a packagewith Common Lisp, we have three possibilities to define new setf-forms:

  • We can define a function whose name is a list of two symbols, the first one being setf, e.g. (defun (setf some-observable) (…)).

  • We can use the short form of defsetf.

  • We can use the long form of defsetf.

  • We can use define-setf-expander.

I am not sure what is the right or intended use-case for each of these possibilities.

A response to this question could hint at the most generic solution and outline contexts where other solutions are superior.

When developing a package, we have three possibilities to define new setf-forms:

  • We can define a function whose name is a list of two symbols, the first one being setf, e.g. (defun (setf some-observable) (…)).

  • We can use the short form of defsetf.

  • We can use the long form of defsetf.

  • We can use define-setf-expander.

I am not sure what is the right or intended use-case for each of these possibilities.

A response to this question could hint at the most generic solution and outline contexts where other solutions are superior.

When developing with Common Lisp, we have three possibilities to define new setf-forms:

  • We can define a function whose name is a list of two symbols, the first one being setf, e.g. (defun (setf some-observable) (…)).

  • We can use the short form of defsetf.

  • We can use the long form of defsetf.

  • We can use define-setf-expander.

I am not sure what is the right or intended use-case for each of these possibilities.

A response to this question could hint at the most generic solution and outline contexts where other solutions are superior.

added 1 character in body
Source Link
melpomene
  • 86.2k
  • 8
  • 96
  • 155

When developing a package, we have three possibilities to define new setf-forms:

  • We can define a function whose name is a list of two symbols, the first one being setf, e.g. (defun (setf some-observable) (…)).

  • We can use the sortshort form of defsetf.

  • We can use the long form of defsetf.

  • We can use define-setf-expander.

I am not sure what is the right or intended use-case for each of these possibilities.

A response to this question could hint at the most generic solution and outline contexts where other solutions are superior.

When developing a package, we have three possibilities to define new setf-forms:

  • We can define a function whose name is a list of two symbols, the first one being setf, e.g. (defun (setf some-observable) (…)).

  • We can use the sort form of defsetf.

  • We can use the long form of defsetf.

  • We can use define-setf-expander.

I am not sure what is the right or intended use-case for each of these possibilities.

A response to this question could hint at the most generic solution and outline contexts where other solutions are superior.

When developing a package, we have three possibilities to define new setf-forms:

  • We can define a function whose name is a list of two symbols, the first one being setf, e.g. (defun (setf some-observable) (…)).

  • We can use the short form of defsetf.

  • We can use the long form of defsetf.

  • We can use define-setf-expander.

I am not sure what is the right or intended use-case for each of these possibilities.

A response to this question could hint at the most generic solution and outline contexts where other solutions are superior.

Source Link

What are the typical use-cases of (defun (setf …)) defsetf and define-setf-expander

When developing a package, we have three possibilities to define new setf-forms:

  • We can define a function whose name is a list of two symbols, the first one being setf, e.g. (defun (setf some-observable) (…)).

  • We can use the sort form of defsetf.

  • We can use the long form of defsetf.

  • We can use define-setf-expander.

I am not sure what is the right or intended use-case for each of these possibilities.

A response to this question could hint at the most generic solution and outline contexts where other solutions are superior.