From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id CAA27240 for caml-redistribution; Tue, 23 Jun 1998 02:54:35 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id CAA20051 for ; Tue, 23 Jun 1998 02:24:24 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.8.7/8.8.7) with ESMTP id CAA20045; Tue, 23 Jun 1998 02:24:22 +0200 (MET DST) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id CAA20345; Tue, 23 Jun 1998 02:24:23 +0200 (MET DST) From: Pierre Weis Message-Id: <199806230024.CAA20345@pauillac.inria.fr> Subject: Re: per-line comments To: Xavier.Leroy@inria.fr (Xavier Leroy) Date: Tue, 23 Jun 1998 02:24:23 +0200 (MET DST) Cc: caml-list@inria.fr In-Reply-To: <19980622105117.39832@pauillac.inria.fr> from "Xavier Leroy" at Jun 22, 98 10:51:17 am X-Mailer: ELM [version 2.4 PL24 ME8] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: weis [French abstract ahead] > Caml's comment syntax is more a question of historical tradition than > personal tastes. After all, the comment syntax is perhaps the only > bit of syntax that hasn't changed between LCF ML, Caml, and Standard ML... Even this bit of syntax has changed: LCF ML comments where % blabla % > > but many good programmers use this > > extensively in their in-line documentation. > > I don't quite get the point about in-line documentation. I write > perfectly fine on-line documentation between (* and *). Why would it > be any better with // or -- ? Right. But many programmers feel it simpler to end the comment with a carriage return (if not for the historical trick of being able to put a new instruction after the comment and to reuse the same card upface down! This is a dinosaure's story from the good old time of real computers that knew the meaning of a column :) > At any rate, the main problem with per-line comments (as with most > syntax extension) is that they need a reserved symbol. Both // and -- > are valid OCaml infix identifiers; // is even used in the Num standard > library module. Perfectly exact and pertinent. Even the (* delimitor is a problem when you want to name operators, since (+), (-), (/) work perfectly but you must use extra spaces for the multiplication. However, the old meaning of % in old LCF ML, was carried to Caml, and may be for this historical reason the % character is not in the list of operators for Caml Light or O'Caml. Thus it is usable as a comment delimitor, if not more useful for another purpose. In addition, per-line comments can be a simple way to have comments that are ``free style'' comments, as opposed to the actual comments that must be a suite of lexically correct tokens. Thus it is possible to add per-line comments, but Xavier pointed out the main problem: is it desirable to add this feature to the langage? [Résumé en Français] Xavier a raison: -- et // sont déjà pris. D'ailleurs (* pose déjà un problème avec la syntaxe des opérateurs infixes (il faut écrire ( * ) pour la multiplication alors que ces blancs sont non nécessaires pour les autres opérateurs). Ceci dit % est inutilisé (et il a toujours signifié début de commentaire depuis le début de ML et même en Caml jusqu'à 1991) et pourrait servir à faire des commentaires uni-lignes (et à l'occasion des commentaires qui ne sont pas une suite de lexèmes valides du langage). Mais est-ce vraiment nécessaire ? Pierre Weis INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/