From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.8 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id CD407BBAF; Wed, 11 Mar 2009 20:03:33 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoECAP+nt0lA6ba4kGdsb2JhbACCfol1h30/AQEBAQkJDAcRA6stgQaPdQEDAQOECgY X-IronPort-AV: E=Sophos;i="4.38,345,1233529200"; d="scan'208";a="24191977" Received: from nf-out-0910.google.com ([64.233.182.184]) by mail3-smtp-sop.national.inria.fr with ESMTP; 11 Mar 2009 20:03:33 +0100 Received: by nf-out-0910.google.com with SMTP id b21so45626nfd.7 for ; Wed, 11 Mar 2009 12:03:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=rOsxpUcFsYPbfRiu88gpK7oagqWa8+3rqWizLqzysXc=; b=eop0YlcOEzccF+3F/wafU05GSkCiUtdcKcpcJelxGTnIVyZtiU0wunE+90oAQ6SNXZ SOzh1+dlJVgNKnlB6hPJMnT0ZjwUre4Se19zJVoxGUAkg2tD6CuJvgpU74/kjOhHTkfn zSRgLJ+zAHt3I18fU4GZR/v2SdbHqRJ56BFDo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=jO/D+3+8p3SQYQPJoJYA6dUa4QJ9/T+NXXgJm0IthVwNNgyufJA+pNALmbJuRbyepi SDXVJGQ9TsOFU3iwSbp51YsqPCaru8jSokaKUS3w6dM0SNQepjHXqiVk/j3EI+ttBZJ/ IJ++KoUgGKAlBpOI4V8a6JQhvRJM5pcUxMloE= MIME-Version: 1.0 Received: by 10.210.136.10 with SMTP id j10mr1606166ebd.24.1236798209857; Wed, 11 Mar 2009 12:03:29 -0700 (PDT) In-Reply-To: References: <87prgoydy1.fsf@aryx.cs.uiuc.edu> <21952156.346634.1236751878001.JavaMail.www@wwinf1b03> <6D1EF1C5-3561-4D45-AE32-48F80EC84E58@cs.princeton.edu> Date: Wed, 11 Mar 2009 15:03:29 -0400 Message-ID: <9d3ec8300903111203q67598fas50658339c9df9c13@mail.gmail.com> Subject: Re: [Caml-list] typing problem with sexplib and mutually recursive polymorphic types From: Till Varoquaux To: Markus Mottl Cc: Damien Doligez , Caml-list List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; recursive:01 ocaml:01 'a-:01 'a-:01 didier:01 mlf:01 ocaml:01 markus:01 mottl:01 markus:01 mottl:01 damien:01 damien:01 type-checker:01 recursive:01 This is a quick overview of my current understanding. Corrections by higher authorities are welcome: Optional type declarations in ocaml only enable to restrict given types (not to generalize them). Although it enables better error reporting it does not allow us to compile anything that would compile without. This can be seen as additional constraints to enforce during typing eg: let f : ('a -> 'a -> 'a) =3D (+) 1 is fine because we have added the constraint "the return type must be the same as both the argument types". If we were type-checking this as 'a.'a->'a->'a this would fail. There's a caveat for formats let f : (_,_,_) format =3D "%s" and object types: let f (v : < pol:'a.'a -> _;..> ) =3D v#pol 4; v#pol () The ability to generalize type by hand is being explored by didier remy in MLF. I do not know how far this is from going in OCaml (if ever). Till On Wed, Mar 11, 2009 at 12:43 PM, Markus Mottl wro= te: > On Wed, Mar 11, 2009 at 12:16, Damien Doligez w= rote: >> That is not quite true any more. =C2=A0For example, I changed the >> type-checker a few years ago to start with the user-provided type >> when typing a let rec, in order to be able to debug my large >> recursive definitions. =C2=A0Note that I didn't do that from scrach, >> I used an infrastructure that was already present for seeding the >> type inference in some cases. =C2=A0IIRC, it is there for some object- >> oriented reason. > > Interesting, this change seems to have passed unobserved by me and is > certainly a great debugging aid. =C2=A0Does this mean that eventually > polymorphic recursion might be supported by OCaml? =C2=A0What's still > missing for that feature? > > Regards, > Markus > > -- > Markus Mottl =C2=A0 =C2=A0 =C2=A0 =C2=A0http://www.ocaml.info =C2=A0 =C2= =A0 =C2=A0 =C2=A0markus.mottl@gmail.com > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >