RE: Implementation 4

From: samepst@cs.bu.edu
Date: Mon Nov 27 2006 - 16:33:23 EST


Return-Path: <samepst@cs.bu.edu>
X-Spam-HitLevel: 
X-Spam-DCC: INFN-TO: cs3.bu.edu 1233; Body=8 Fuz1=8 Fuz2=8
X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on cs3.bu.edu
X-Spam-Level: 
X-Spam-Status: No, score=-2.5 required=10.0 tests=AWL,BAYES_00,NO_REAL_NAME  autolearn=no version=3.1.0
X-Spam-Pyzor: 
Received: from csa3.bu.edu (csa3 [128.197.12.5]) by cs3.bu.edu (8.13.6/8.13.6) with ESMTP id kARLXMg3002196 for <cs520@cs.bu.edu>; Mon, 27 Nov 2006 16:33:22 -0500
Received: (from apache@localhost) by csa3.bu.edu (8.13.6/8.12.11/Submit) id kARLXNY5010411; Mon, 27 Nov 2006 16:33:23 -0500
X-Authentication-Warning: csa3.bu.edu: apache set sender to samepst@cs.bu.edu using -f
Received: from 71.192.166.44 (SquirrelMail authenticated user samepst) by cs-squirrelmail.bu.edu with HTTP; Mon, 27 Nov 2006 16:33:23 -0500 (EST)
Message-ID: <11582.71.192.166.44.1164663203.squirrel@cs-squirrelmail.bu.edu>
Date: Mon, 27 Nov 2006 16:33:23 -0500 (EST)
Subject: RE: Implementation 4
From: samepst@cs.bu.edu
To: cs520@cs.bu.edu
User-Agent: SquirrelMail/1.4.6-4.fc2.1.legacy
Content-Type: text/plain;charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Priority: 3 (Normal)
Importance: Normal
X-Clamav-Status: No
Status: RO
Content-Length: 1516
X-UID: 63
X-Keywords:                                                                                                    

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