Arc Forumnew | comments | leaders | submitlogin
3 points by rkts 6121 days ago | link | parent

Another (fairly obvious) idea: since optional parameters can't be followed by non-optional ones, just have a single ? for all optional parameters, as in CL:

  (fn (a b ? (c 3) (d 4)) ...)
This is shorter and mirrors the dot notation for rest parameters.


4 points by pg 6121 days ago | link

I wanted to leave open the option of other types of parameters besides optional ones.

-----

2 points by bogomipz 6119 days ago | link

Does the suggestion really close that door? For instance, if you wanted to add keyword arguments, they could go like this:

  (fn (a b ? (c 3) (d 4) ! (e 5) (f 6) . rest) ...)
Combining all four argument flavors in the same function is of course not a good idea.

-----

1 point by kennytilton 6117 days ago | link

Looks like how common lisp works. And agreed: mixing optional with keyword args would be a nasty thing to do to users. Probably they saw that it was /possible/ and said sure, why not?

-----