[racket] TR: scope of universally quantified type variables is ... very strange?
On Jan 5, 2012, at 5:32 PM, Sam Tobin-Hochstadt wrote:
> On Thu, Jan 5, 2012 at 11:56 PM, John Clements
> <clements at brinckerhoff.org> wrote:
>> I wrote a piece of code like this without thinking:
>>
>> #lang typed/racket
>>
>> (: f (All (T) (Number -> T -> T)))
>> (define ((f x) y)
>> (ann y T))
>>
>> ... and then, after a second, was sort of flabbergasted that it worked. What's the scope of the type variable T? Apparently I can use it anywhere in the definition of the identifier that it names? That seems really fragile. Am I misunderstanding this?
>
> You're correct about the scope, and the fact that you wrote it without
> thinking, and it just did the right thing, is precisely what I was
> going for. What's fragile here?
Okay, yes, it makes sense. The scope is not defined by a pair of parentheses, but I guess I can get past that; after all, our internal defines are headed in that direction, too.
John
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4624 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20120106/017bcce5/attachment.p7s>