gerbil icon indicating copy to clipboard operation
gerbil copied to clipboard

Compiler rejects _ as case-lambda parameter

Open fare opened this issue 5 years ago • 0 comments

The following form is valid at the REPL, but causes the compiler to blow up:

(def hash-ref-set! (case-lambda ((h k v) (hash-put! h k v)) ((h k _ v) (hash-put! h k v))))

Compiler error:

*** ERROR IN gxc#generate-runtime-call% -- Syntax Error
*** ERROR IN ?
--- Syntax Error at compile: Cannot compile reference to uninterned identifier
... form:   #f

Workaround: renaming _ to _d.

fare avatar Jul 21 '20 17:07 fare