Return-Path: <shearer@cs.bu.edu> X-Spam-HitLevel: X-Spam-DCC: INFN-TO: cs3.bu.edu 1233; Body=1 Fuz1=1 Fuz2=1 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on cs3.bu.edu X-Spam-Level: X-Spam-Status: No, score=-4.4 required=10.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.0 X-Spam-Pyzor: Received: from SHEARERSHOT (cs-dhcp150 [128.197.10.150]) (authenticated bits=0) by cs3.bu.edu (8.13.6/8.13.6) with ESMTP id kARLtr8R011435; Mon, 27 Nov 2006 16:55:59 -0500 Message-Id: <200611272155.kARLtr8R011435@cs3.bu.edu> From: "Rui Shi" <shearer@cs.bu.edu> To: <samepst@cs.bu.edu> Cc: <cs520@cs.bu.edu> Subject: RE: Implementation 4 Date: Mon, 27 Nov 2006 16:55:56 -0500 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 Thread-Index: AccSa6mg6jcc863PTv2I4FV1S/ouYQAAuaKw In-Reply-To: <11582.71.192.166.44.1164663203.squirrel@cs-squirrelmail.bu.edu> X-Clamav-Status: No Status: RO Content-Length: 1816 X-UID: 64 X-Keywords:
Please refer to the Pierce's book carefully, you only gerneralize the type
vars which are *not* free in the context.
- Rui
-----Original Message-----
From: samepst@cs.bu.edu [mailto:samepst@cs.bu.edu]
Sent: Monday, November 27, 2006 4:33 PM
To: cs520@cs.bu.edu
Subject: RE: Implementation 4
Hello,
I would argue that explicit qualifiers are essential. My case is the
following ill-typed term:
let f =
lam y =>
let g = y in ((g 5),(g false))
in f
y is not a free type variable in the nested let. If you are not using
qualifiers, then g would take y's type, which is TpUni(i). g then could be
applied to 5 and false without problem, even though it is not valid to do
so.
but by using qualifiers, and pierce's implementation strategy of changing
out all qualified type variables at the instance of every variable, this
issue could be avoided.
Thank You,
-Sam Epstein
>
>
> Hi,
>
> I didn't see the point of the change. From my point of view, "TpUni
> of int"
> is sufficient for the purpose.
>
> In fact, to represent universal type scheme, you don't need to have
> explicit qualifiers as implied by your proposed changes. For instance
>
> let f = lam y => y in (f 10, f true)
>
> when you do the constraint generation, f's type can be (TpUni 1 ->
> TpUni
> 1)
> which is equivalent to \forall a. a -> a.
>
> Hope that is helpful.
>
> - Rui
>
> -----Original Message-----
> From: samepst@cs.bu.edu [mailto:samepst@cs.bu.edu]
> Sent: Monday, November 27, 2006 12:44 PM
> To: shearer@cs.bu.edu
> Subject: Implementation 4
>
> Hello,
>
> I had to make a few changes to the framework of programming assignment
> 4 to implement the let-polymorphism using type scheme. I changed:
>
> TpUni of int
>
> to
>
> TpScheme of int list * stp
>
>
> is this acceptable?
>
> Thanks,
> -Sam
>
>
>
>
>
>
This archive was generated by hypermail 2b29 : Thu Dec 14 2006 - 16:31:59 EST