On Wed, Jan 4, 2017 at 6:05 PM, Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de> wrote:

While for most use cases (optional parameters), the syntax and semantics is definitely not optimal (you mentioned the quadratic code size, for example), I see one use case, for which it seems to fit:

(define f
  (case-lambda
    ((x y z) (* x y z))
    (args (error "f has to be invoked with exactly three arguments"))))

How would you code this without case-lambda so that optimal code is produced when f is well-known at a call-site?

(define f (lambda (x y z) (* x y z)))

NB: In my Rapid Scheme front-end, I am currently using case-lambda as a core form, but it does replace lambda, so the number of core forms do not change. And handling case-lambda-nodes is no more difficult than handling lambda-nodes in an AST (you just have one more loop, over the clauses).

I don't want the extra loop - in fact, I don't want
extra code at all, I just want to pattern match the
form.

-- 
Alex