plt/racket — pull request #564 by takikawa (2014-02-05 16:20:23+00:00)
Title: TR: generalize rest argument types [draft]

This draft pull request is for an unfinished feature that's been under discussion but won't necessarily be merged (so don't code review it). It generalizes the current `Foo *` rest arguments (i.e., uniform rest argument types) so that any list type can be specified for the rest argument type.

The reason this is a draft is because I'm not sure the feature is worth it. It's somewhat complex to implement (inference is broken right now) and the benefits are relatively small. It's also awkward for the type syntax.

The main benefit is that you can give a type for `hash`:

````
Welcome to Racket v6.0.0.1.
-> hash
- : (All (a b)
((Rec x (U Null (Pairof a (Pairof b x)))) *@ -> (HashTable a b)))
#
-> ((inst hash Symbol String) 'k1 "val")
- : (HashTable Symbol String)
'#hash((k1 . "val"))
-> ((inst hash Symbol String) 'k1 "val" 'k2)
; readline-input:4:0: Type Checker: type mismatch
; expected: (Rec g532 (U Null (Pairof Symbol (Pairof String g532))))
; given: (List 'k1 String 'k2)
; in: ((inst hash Symbol String) (quote k1) "val" (quote k2))
; [,bt for context]
-> ((inst hash Symbol String) 'k1)
; readline-input:5:0: Type Checker: type mismatch
; expected: (Rec g542 (U Null (Pairof Symbol (Pairof String g542))))
; given: (List 'k1)
; in: ((inst hash Symbol String) (quote k1))
; [,bt for context]
````