Summary

Avoid consing for optional procedure arguments

Metadata

Attachments

Description

Currently, anything that accepts optional, rest or keyword arguments has to build a list and then pick that list apart. This is wasteful because it should not be necessary at all.

We could start with the low-hanging fruit like `case-lambda` and `#!optional`, where the binding of arguments and argument count checking is relatively simple. Handling `#!key` and `#!rest` or dotted tail rest argument notation is something that seems to me either too difficult and possibly not even worth it: you usually **want** to treat those as a list (but patterns like `optional` could still be handled specially, if nothing else refers to the identifier).

Changes and comments

[2019-06-12 08:45:04 UTC] sjamaan changed summary

[2019-07-24 10:38:00 UTC] evhan changed version from 5.0.0rc1 to 5.0.0

[2019-07-24 10:38:00 UTC] evhan wrote:

Moving to 5.0.0 just to keep the listings tidy.

[2019-08-04 14:45:14 UTC] sjamaan changed milestone from someday to 5.2

[2019-08-25 17:56:29 UTC] felix changed milestone from 5.2 to 5.3

[2019-10-26 16:24:06 UTC] sjamaan attached rest-args.patch (description=Patch against e25965)

[2019-10-27 13:16:52 UTC] sjamaan attached 0001-Replace-car-cdr-null-on-rest-args-with-direct-argvec.patch (description=Final version including explanatory commit message sent to the mailing list)

[2019-11-18 21:22:00 UTC] felix wrote:

Final version has been applied.

[2019-11-26 09:34:54 UTC] sjamaan changed status from new to closed

[2019-11-26 09:34:54 UTC] sjamaan set resolution to fixed

[2019-11-26 09:34:54 UTC] sjamaan changed milestone from 5.3 to 5.2

[2019-11-26 09:34:54 UTC] sjamaan wrote:

This has been implemented for `#!optional`, `let-optionals*` and also `case-lamdba`. There might be room for improvement (as always), but for now I feel we've done enough; the approach we use even makes manual accesses of rest arguments optimisable, depending on the exact pattern used, of course.