Skip to content
This repository has been archived by the owner on Dec 29, 2018. It is now read-only.

export-constructors doesn't export default constructor from defstruct when another constructor specified #24

Open
fourier opened this issue Mar 28, 2016 · 0 comments

Comments

@fourier
Copy link

fourier commented Mar 28, 2016

defstruct in CL allows to specify several constructors. If second argument to the :constructor keyword provided, it is used as a constructor name. :constructor with no arguments creates a default constructor.
However if both BOA(By Order of Arguments) and explicit default constructor provided, the export-constructors macro exports only BOA constructor, see the session below:

CL-USER 28 > (defstruct (point (:constructor create-point (x y)) (:constructor)) x y)
POINT

CL-USER 29 > (create-point 10 20)
#S(POINT :X 10 :Y 20)

CL-USER 30 > (make-point :x 10 :y 10)
#S(POINT :X 10 :Y 10)

CL-USER 31 > (pprint (macroexpand '(cl-annot.class:export-constructors (defstruct (point (:constructor create-point (x y)) (:constructor)) x y))))

(PROGN
  (EXPORT '(CREATE-POINT))
  (DEFSTRUCT (POINT (:CONSTRUCTOR CREATE-POINT (X Y)) (:CONSTRUCTOR)) X Y))
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant