shithub: sl

Download patch

ref: 499e3da259191309927991b3a750f8a34c6f26d3
parent: 62e25d18e753b394544edd76117d9a7aaedd3714
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Wed Apr 16 18:49:25 EDT 2025

defstruct-produced docs: include renamed constructor

--- a/boot/sl.boot
+++ b/boot/sl.boot
@@ -89,7 +89,7 @@
   error "invalid slot name: " #fn(list*) #fn(sym) #\:))) tokw) separate-doc-from-body #fn(length)
   #fn(map) #fn("n10B3500<:0:") list arg-error "invalid struct type: " "structs of type `vec` are always :named T"
   #fn(sym) #\? "predicate not possible unless the struct is :named T" struct … "make-" #fn(str) "-"
-  #fn("n12002152853=0220E8553@300853<02208552@40232486252627e1A360q@7028Fe292360q@802992e293360q@802:93e2943;02;94e2@30q95S;J80495DQS;39042<95e29697P578764:" #(#fn(str-find)
+  #fn("n12002152853=0220E8553@300853<02208552@40232486252627e1A360q@7028Fe292360q@802992e2933<093DC60q@802:93e2943;02;94e2@30q95S;J80495DQS;39042<95e29697P578764:" #(#fn(str-find)
   "\n\n" #fn(str-sub) "" #fn(str) "\n\n    " #fn(append) defstruct :type :named :constructor
   :conc-name :predicate) fmt) sym-set-doc #fn(append) :doc-fmt #fn(nconc) begin def s equal?
   type-of quote and eq? aref = length 1+ %struct% #fn(copy-list) foldr #fn("n2202105201PP:" #(#fn(sym)
--- a/src/system.sl
+++ b/src/system.sl
@@ -1179,10 +1179,14 @@
         (str hd
              "\n\n    "
              (append (list 'defstruct)
-                     (unless isvec (list :type type))
-                     (unless named (list :named named))
-                     (unless constructor (list :constructor constructor))
-                     (if conc-name (list :conc-name conc-name))
+                     (unless isvec
+                       (list :type type))
+                     (unless named
+                       (list :named named))
+                     (unless (and constructor (eq? constructor T))
+                       (list :constructor constructor))
+                     (when conc-name
+                       (list :conc-name conc-name))
                      (and (or (not predicate)
                               (not (eq? predicate T)))
                           (list :predicate predicate))