From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 54B507F720 for ; Mon, 14 Apr 2014 08:13:05 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of mshinwell@janestreet.com) identity=pra; client-ip=38.105.200.229; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mshinwell@janestreet.com"; x-sender="mshinwell@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of mshinwell@janestreet.com designates 38.105.200.229 as permitted sender) identity=mailfrom; client-ip=38.105.200.229; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mshinwell@janestreet.com"; x-sender="mshinwell@janestreet.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mxout3.mail.janestreet.com) identity=helo; client-ip=38.105.200.229; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mshinwell@janestreet.com"; x-sender="postmaster@mxout3.mail.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuoBAD98S1MmacjlnGdsb2JhbABag0FXrBWWL1GBFh4OAQEBAQEGFgk8giUBAQEEQAEBKgIIAwEPCwsNDSEiEgEFAQoSBhMSh1YDEQMCCJxDixiEVQEFl10Dhm0RBo5uB4Q4mGWBNo8eGCmEYA X-IPAS-Result: AuoBAD98S1MmacjlnGdsb2JhbABag0FXrBWWL1GBFh4OAQEBAQEGFgk8giUBAQEEQAEBKgIIAwEPCwsNDSEiEgEFAQoSBhMSh1YDEQMCCJxDixiEVQEFl10Dhm0RBo5uB4Q4mGWBNo8eGCmEYA X-IronPort-AV: E=Sophos;i="4.97,855,1389740400"; d="scan'208";a="68062890" Received: from mx5.janestreet.com (HELO mxout3.mail.janestreet.com) ([38.105.200.229]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 14 Apr 2014 08:12:46 +0200 Received: from tot-oib-smtp1.delacy.com ([172.27.22.15] helo=tot-smtp) by mxout3.mail.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1WZa8J-0006Fn-C9 for caml-list@inria.fr; Mon, 14 Apr 2014 02:12:43 -0400 Received: from tot-dmz-mxgoog1.delacy.com ([172.27.224.14] helo=mxgoog2.janestreet.com) by tot-smtp with esmtps (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1WZa8J-0006m1-Ax for caml-list@inria.fr; Mon, 14 Apr 2014 02:12:43 -0400 Received: from mail-ve0-f182.google.com ([209.85.128.182]) by mxgoog2.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1WZa8J-0005VY-87 for caml-list@inria.fr; Mon, 14 Apr 2014 02:12:43 -0400 Received: by mail-ve0-f182.google.com with SMTP id jw12so7206619veb.13 for ; Sun, 13 Apr 2014 23:12:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=D7VwVU52A59KYWTroiqmqAS8Ewp76yMBlNuhC/ixX7k=; b=yRdwUO8kS2mmIFmrJGkEdouop3bocQytkIkBu0k7aiU+jTtagh08nTVU11pY6oe7vS EozMrdGaejq7qCc+Fy090I0mH++S94fktLHYvlUhMJUGNh7BEEZ6irOwjxzxn8Qbb5Ap 7ZYIsVeYykq2vIMsjElFx45CBzHyjYGJ4CWSc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=D7VwVU52A59KYWTroiqmqAS8Ewp76yMBlNuhC/ixX7k=; b=ftvzzqjffAbJiD6Uiowg83Ay3ttD0YEX+8ApimCE/kxklMA+JdRmjK0r48GKLT+DOQ qRJnwpJr9MfvYWOVipfK9Hk/+IW77eMZAPC7+7zN5rLLaEisa4769HJL19teu1AzuJfC 2spYzAZjZgDm7zSpu97545oBZYMYPiQMUu/Stz6S+hMZOaIufWfUBpUUb8T0/ngGTTNF ny3SSxYUiFdhgvjO5OMleJXx7QnSAbLOc8xZHjIdGq94KqPcfbS4eYzkMURy3ipdVTJ7 SgaL96yJzFFCgcnj2XUiAzVaKKz1U3uF0uZR/moLzuEx41X/Tj26T61mAw5z/PrPbeuk Bs5w== X-Gm-Message-State: ALoCoQnvOqdL02pPk4Whhp1Y7dkXm7T8ly2P28xBcEGq/+CMv021lk3krmynjCKgubLD78g1jmC4y8ngmwUMLjCqqgRTkpNqEvxaZTO9vpCvTJKHKS+Ey2t0o+tzX7QpfsEh5guSrkB3 X-Received: by 10.220.167.2 with SMTP id o2mr34915555vcy.8.1397455963097; Sun, 13 Apr 2014 23:12:43 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.220.167.2 with SMTP id o2mr34915544vcy.8.1397455963007; Sun, 13 Apr 2014 23:12:43 -0700 (PDT) Received: by 10.58.218.9 with HTTP; Sun, 13 Apr 2014 23:12:42 -0700 (PDT) In-Reply-To: <533DC189.5090206@frisch.fr> References: <533DC189.5090206@frisch.fr> Date: Mon, 14 Apr 2014 07:12:42 +0100 Message-ID: From: Mark Shinwell To: Alain Frisch Cc: Yotam Barnoy , Ocaml Mailing List Content-Type: text/plain; charset=ISO-8859-1 X-Validation-by: mshinwell@janestreet.com Subject: Re: [Caml-list] Ocaml compiler documentation Alain, I think "open!" does affect the "unused open" warning. (This is a useful feature when you are trying to establish a consistent set of in-scope names, a good example being Core's "open Int.Replace_polymorphic_compare", which you may well want to have even if your file doesn't happen to use a comparison operator right now.) I checked this using the following test program and "-w +a". module M = struct let foo x = x + 42 end open! M (or "open") Mark On 3 April 2014 21:16, Alain Frisch wrote: > On 4/3/2014 4:48 AM, Yotam Barnoy wrote: >> >> Ok I think a good place to start a tour of the compiler is in >> parsing/parsetree.mli. This file is actually very well documented, with >> terse but effective examples of almost every constructor and type. > > > Good idea indeed, especially that the Parsetree will gain in the next > release a more important status, with -ppx rewriters, annotations and > attributes. > > >> I had to refer to the OCaml manual for a few of the corner cases. For >> example, I didn't know about the #class type shortcut. I think a few >> comments explaining the more obscure facets of the language could be >> helpful. > > > Generally speaking, a good place to document the language is the user > manual. Don't hesitate to suggest patches to the manual as well! (The > source code is in the same repository: > http://caml.inria.fr/cgi-bin/viewvc.cgi/ocamldoc/trunk/ ). > > That said, for the specific case of Parsetree, it might indeed be useful to > give some hints about rare language features in the source code as well. > > >> 1. What is the difference between an extension and an attribute? From >> what I understand, they are both means of integrating additional >> metadata into the AST that can then be parsed by implementations of the >> ast-mapper, but why are there 2 mechanisms? > > > An extension is something which will be rejected by the type-checker. It is > placeholder for "sub-languages", to be processed by -ppx filters. > > An attribute is indeed a way to integrate meta-data into a (hopefully) valid > AST. They could be used by -ppx filters to drive their behavior, by > external tools to get some extra information (e.g. Bisect annotations), and > they are propagated to the typedtreed, and hence to .cmt/.cmti files, again > for external tools which read those files. They are also kepts on some > kinds of declarations (e.g. values and types) so that they are part of the > Types structures, and hence found in .cmi files as well. The compiler also > give a built-in meaning to some attributes (to be documented). > > Some more information: > http://caml.inria.fr/cgi-bin/viewvc.cgi/ocaml/trunk/experimental/frisch/extension_points.txt?revision=HEAD&view=markup > > >> 3. line 684: what is the purpose of the override flag on Pstr_open? It's >> not explained by the comment. > > > The override flag (i.e. "open!" as opposed to "open") is used to silence the > new warning which signals when an open statement shadows an existing > identifier which is later used. (It does not affect the 'unused open' > warning.) > > >> 4. The toplevel phrases are not clear. What is the purpose of Ptop_dir >> on line 721? > > > Those are #-directives understood by the toplevel (#use, #load, etc). > > > -- Alain > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs