ruricolist / serapeum

Utilities beyond Alexandria
MIT License
415 stars 41 forks source link

`:` instead of `->` #177

Open jgarte opened 1 month ago

jgarte commented 1 month ago

Hi,

What do you think if instead of -> for annotating types that we use :?

So for example,

(: dict* (hash-table &rest t) hash-table)
(defun dict* (dict &rest args)
  ...)

Instead of

(-> dict* (hash-table &rest t) hash-table)
(defun dict* (dict &rest args)
  ...)

This will avoid conflicts with lispers that like to commonly use function threading arrow macros such as ->.

What do you think?

ruricolist commented 1 month ago

I like it aesthetically, but I don't think it's workable in CL. It would have to be written :||; not all Lisps allow binding macros to keywords; and generally it would be considered bad style in CL for a library to change a global binding outside its package.

jgarte commented 1 month ago

Thanks for the reply. Your points make sense. Not sure what else to add but thanks for the information. I'll ponder it further. I might just write vanilla type specifiers instead when needed since the arrow conflicts with my threading arrow usually.