racket/typed-racket

case-lambda allows multiple cases with the same arity

Ouverte

#517 ouverte le 24 mars 2017

 (5 commentaires) (0 réaction) (0 personne assignée)Racket (106 forks)github user discovery
arrowgood first issue

Métriques du dépôt

Stars
 (576 étoiles)
Métriques de merge PR
 (Merge moyen 11j 14h) (1 PR mergée en 30 j)

Description

[I originally opened this as an issue for racket, but it more clearly violates the docs for typed/racket.]

Although for racket it doesn't seem explicitly forbidden, the typed/racket docs say:

Note that each formals must have a different arity.

Should this perhaps be an expansion-time error:

> (case-lambda [([z : Zero]) z]
               [([o : One]) o])
- : (-> Zero Zero)

This came up because a student encountering the case-> type constructor wondered whether case-lambda would provide overloading by type.

Guide contributeur