On Monday, November 9, 2015 at 3:17:59 AM UTC, Neil Van Dyke wrote: > Note that, unlike some languages, I *don't* want `x` and `y` to be > optionally positional -- only keyworded.
In my opinion, supplying a default value should make an argument implicitly keywordable. So (define (a b c (d 3) (e 4)) ...) would have 2 required positional arguments, and d and e could be present or omitted. If an argument has a default, it means it should be possible to omit it, and if you cannot specify keywords for the arguments after it (with defaults) then you cannot omit it. That leads to things like this: (define (foo a b (c #f) (d null) (e null))) (list a b c d e)) (let ((e '(1 2 3))) (list (foo 1 2 #f null e) (foo 1 2 #f null '(2 3 4)) (foo 1 2 #f e e) (foo 1 2 #f e))) Notice how in all cases the "optional" argument c had to be explicitly specified with its own default value. That is confusing because people can't tell if you mean "just ignore this and use the default" or "I really do think it important that c have this value." So, optional /non-keywordable/ arguments are a bad idea, in my opinion. Being able to do something like this is very important for clarity: (let ((e '(1 2 3))) (list (foo 1 2 :e e) (foo 1 2 :e '(2 3 4)) (foo 1 2 :d e :e e) (foo 1 2 :d e))) I don't have a real preference whether d and e should be allowed to be /positional/ though. It seems reasonable that it might be confusing to go (a 1 2 3 4) where either 3 or 4 are optional arguments with defaults if omitted. A case-lambda would be the best form if you really want (a 1 2) (a 1 2 3) and (a 1 2 3 4). But on the other hand, it doesn't seem too bad, as long as I have the option of specifying those optional arguments as keywords. But I don't have that option, because I have to say "#:keyword-argument (keyword-argument default)" or it doesn't /let/ me use a keyword to specify that argument's value. That leads to me being forced to boilerplate in defaults for intermediary optional variables. So, that's my big beef with the lambda/define syntax. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.