caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Ingo Bormuth <ibormuth@efil.de>
To: caml-list@yquem.inria.fr, mikelin@mit.edu
Subject: Re: [Caml-list] ocaml+twt v0.90
Date: Tue, 23 Jan 2007 21:43:13 +0100	[thread overview]
Message-ID: <20070123204313.GA4163@efil.de> (raw)
In-Reply-To: <2a1a1a0c0701161248l5a1d9ad9q739da9c593fc5219@mail.gmail.com>

On 2007-01-16 15:48, Mike Lin wrote:
> This version introduces a major backwards-incompatible change: the
> eradication of "in" from let expressions, and the need to indent the let
> body (as suggested by the F# lightweight syntax). 

I downloaded the new version some day ago and immediately fell in love
with the compact syntax. In my opinion it feels much more natural.
I especially realized that it took me more effort to convert old
ocaml+twt code (lots of semantically relevant indentation changes) then
it did to convert vanilla ocaml code (essentially s/ *\( in\|;\)$//g
plus some optional parentheses removal).

> I was hesitant to introduce this feature because it's extra hackish in
> implementation (even moreso than the rest of this house of cards). It also
> removes some programmer freedom, because you cannot have the let body on the
> same line as the let, and you cannot have a statement sequentially following
> the let, outside the scope of the binding. 

A let body beginning in the first line is no problem if you add an
additional semicolon:

let print x y = print_string x ;   (* <-- note the semicolon *)
  print_string " "
  print_string y
print "Hello" "World"


If you need a function in private scope you can easily declare and call 
it inside a 'let _ =' block:

let x = 5
printf "%d\n" x
let _ =
  let y = x+1
  printf "%d\n" y
printf "no y here"


I ran into some minor problems due to ocaml+twt not recognizing the
object related syntax. As I personally use it only in rare cases, I
ended up with just putting the critical section in one long line.

I suggest to implement the '#light' pragma (as in f#) which would allow 
to swith on and off indentation awareness on the fly. This would also 
enable me to replace all ocaml compilers by wrappers calling ocaml+twt
implicitly. If you want I can prepare a little patch.

Thanks for your effort -- keep going on

  Ingo



-- 
Ingo Bormuth, voicebox & fax: +49-(0)-12125-10226517
public key 86326EC9, http://ibormuth.efil.de/contact


  parent reply	other threads:[~2007-01-23 20:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-16 20:48 Mike Lin
2007-01-17  9:14 ` marshaling limits Sebastien Ferre
2007-01-17  9:36   ` [Caml-list] " Olivier Andrieu
2007-01-17 15:33   ` Frédéric Gava
2007-01-17 15:41     ` Sebastien Ferre
2007-01-17 16:12       ` Daniel Bünzli
2007-01-17 16:32         ` Olivier Andrieu
2007-01-18  8:14           ` Sebastien Ferre
2007-01-17 16:34         ` Sebastien Ferre
2007-01-17 19:37           ` Jonathan Roewen
2007-01-17 19:50           ` Yaron Minsky
2007-01-17 22:51             ` Markus Mottl
2007-01-23 20:43 ` Ingo Bormuth [this message]
     [not found]   ` <2a1a1a0c0701231322h48e3af00m9f07371f236fe7c@mail.gmail.com>
2007-01-24 16:09     ` [Caml-list] ocaml+twt v0.90 Ingo Bormuth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070123204313.GA4163@efil.de \
    --to=ibormuth@efil.de \
    --cc=caml-list@yquem.inria.fr \
    --cc=mikelin@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).