ruricolist / serapeum

Utilities beyond Alexandria
MIT License
415 stars 41 forks source link

Optional return values in `->` #152

Closed aartaka closed 1 year ago

aartaka commented 1 year ago

Hi!

This PR bundles two changes:

Making the values argument to the -> macro into an optional one.

It's often the case, especially on SBCL, that it's not possible to define a portable type that compiler will not warn about. Which makes -> kind of useless if one wants to have no warnings in their code (we have such a no-warnings regression test in Nyxt). Thus the change: allowing no return values to be specified in ->.

Forcing the args of -> to be a list.

This one is offloading part of the validity checking into the macro, instead of type checks and runtime checks. Macro argument checking errors are easier to catch and understand, while the errors down the line are much harder to make sense of. So here it is: args is now (&rest args).

Both changes are backwards-compatible.

ruricolist commented 1 year ago

Merged, thanks!