Opened 7 years ago

Closed 6 years ago

#54 closed defect (wontfix)

optional arguments

Reported by: cowan Owned by: alexshinn
Priority: major Milestone:
Component: WG1 - Core Keywords:


Scheme's primitive mechanism of improper lambda-lists allows for optional arguments, but only with extra machinery. CL, DSSSL, and some Schemes provide a special word such as #!optional in lambda-lists, showing that the arguments which follow are optional and may have default values. SRFI 16 (case-lambda) is an alternative method of providing for optional arguments: it allows a procedure to define multiple lambda-lists each of different lengths, with separate bodies for each. This is like method overloading, but without types.

Change History (6)

comment:1 Changed 7 years ago by cowan

I think it's important to have a simple approach to optional arguments. Programmers often want them, although it's difficult to count such instances because so much code just cracks the lambda-list-tail variable. Such code is often brittle, simply ignoring excess optional arguments even if the surrounding Scheme implementation reports errors on them.

The #!optional keyword requires special magic in the lambda form. Case-lambda can be provided directly by a syntax-rules macro, and therefore I prefer it.

comment:2 Changed 7 years ago by arcfide

I also prefer the CASE-LAMBDA in the standard. I think that it is easy to add in optional keyword arguments using records or the like, so I don't see a need for them to be in the standard. I'm not sure that CASE-LAMBDA is a suitable addition to WG1 though.

comment:3 Changed 7 years ago by medernac

I am also in favor of Case-Lambda syntax provided as a macro.

comment:4 Changed 7 years ago by cowan

  • Resolution set to fixed
  • Status changed from new to closed

The WG voted to refer optional-argument support (excluding case-lambda, which is #78) to WG2.

comment:5 Changed 6 years ago by cowan

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:6 Changed 6 years ago by cowan

  • Resolution set to wontfix
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.