From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id PAA24077 for caml-redistribution; Wed, 24 Jul 1996 15:51:52 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.6.10/8.6.6) with ESMTP id LAA22715 for ; Wed, 24 Jul 1996 11:56:16 +0200 Received: from news2.tokyo.intervia.ad.jp (news2.tokyo.intervia.ad.jp [202.235.64.84]) by nez-perce.inria.fr (8.7.1/8.7.1) with SMTP id LAA05368 for ; Wed, 24 Jul 1996 11:56:00 +0200 (MET DST) Received: from sparc1.nextsolution.co.jp (sparc1.nextsolution.co.jp [202.235.80.1]) by news2.tokyo.intervia.ad.jp (8.6.12+2.4W/intervia-1.7u) with SMTP id SAA03051; Wed, 24 Jul 1996 18:55:48 +0900 Received: from sparc3.nextsolution.co.jp by sparc1.nextsolution.co.jp (5.x/SMI-SVR4) id AA04283; Wed, 24 Jul 1996 18:53:43 +0900 Received: by sparc3.nextsolution.co.jp (5.x/SMI-SVR4) id AA00610; Wed, 24 Jul 1996 18:53:44 +0900 Date: Wed, 24 Jul 1996 18:53:44 +0900 From: christo@nextsolution.co.jp (Frank Christoph) Message-Id: <9607240953.AA00610@sparc3.nextsolution.co.jp> To: Pierre.Weis@inria.fr Cc: caml-list@pauillac.inria.fr In-Reply-To: <199607240844.KAA21840@pauillac.inria.fr> (message from Pierre Weis on Wed, 24 Jul 1996 10:44:17 +0200 (MET DST)) Subject: Re: Language improvements (?) Sender: weis > I don't know exactly what you mean by a ``symbolic identifier'', if > you mean an identifier entirely made of characters that are not > letters or parens (e.g. ++ or <=> or >>), then Caml support it. Sorry, I just noticed that myself after looking at the sources. Maybe it should be mentioned more prominently and under the same heading as identifiers in the lexical conventions section of the manual. It's sort of easy to miss it as the last part of the last sentence under the "Prefix and infix symbols" heading: "... but otherwise behave much as identifiers." I also noticed that you cannot use such identifiers as method names, which makes sense as the language stands now, but if you were able to syntatically separate method invocations from their objects (owners), infix or prefix methods would be sensible. (Granted, I don't know if that suggestion was workable or not.) >> Third, since the trend in O'Caml is toward curried function types, it would >> be useful to be able to section binary operators as in Haskell, e.g., "(1+)" >> would mean "(function x -> 1 + x)". > > Wao! Is this so useful ? If you get in the habit of defining symbolic identifiers it is. Judging from how often I see people write "leq" instead of something like "(<==)" (not "<=", to avoid the keyword), I guess this is not so common in the ML world. Anyway, it's a trivial extension, and it allows you to curry symbolic identifiers in the same way as conventional identifiers. >> And, at the risk of instigating a syntax war, I would prefer a more >> Haskell-like syntax overall; for example, offside scoping, > >By ``offside scoping'', you mean a ``where'' construct, I presume ? No, although that would be nice too. :) I mean an indentation convention for lexical scoping. For example, instead of if x = y then (do_a; if x = z then do_b) else do_the_other_thing write: if x = y then do_a; if x = z then do_b else do_the_other_thing Here the lexical analyzer can determine that the else-clause belongs to the first "if" because the position of the "else" is to the left of the second "if" (off-side) and thus must belong to an outer scope. Most people will not be convinced by this example because dangling if's don't occur that often in practice, esp. in a mostly-functional language, but it also helps in nested match's and let's, etc. This convention enforces a certain style of formatting, it's true, but it's a good style, and very readable. The two major problems with the convention are easy to fix. First, it makes it more difficult to generate programs automatically because scoping is more subtle. You can fix this by mandating that the convention is not in effect between an explicit "begin" and an "end". (This requires some small adjustments to the syntax, I suppose, like changing "sig ... end" to "sig begin ... end".) The second problem is more or less a non-issue in Objective Caml. In Haskell, modules need to start with an explicit declaration "module ModuleName where ..." (oh, is this what you meant by "where"?) which would mean that, if the entire file is one module, all subsequent lines would need to be indented at least one space. This can be fixed by adopting the convention that the first line of a file is considered to have a "negative" indentation, or something similar. In O'Caml the compiler inserts the module declaration for you, so it's not a problem. Most people indent their code anyway, so off-side scoping just helps to eliminate syntax noise. Also, it helps prevent mistakes (like forgetting to delimit nested match's, as I said, which I have gotten caught in more than once now). The convention is easy to get used to, and, for me, it was so successful in Haskell that I really miss it in O'Caml. ------------------------------------------------------------------------ Frank Christoph Next Solution Co. Tel: 0424-98-1811 christo@nextsolution.co.jp Fax: 0424-98-1500