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=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 0D410BC6C for ; Sat, 19 Jan 2008 07:50:57 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAGcskUfC2fJVlmdsb2JhbACJD4cGAQEBAQcEBgcKEQecMYEz X-IronPort-AV: E=Sophos;i="4.25,220,1199660400"; d="scan'208";a="21496686" Received: from anchor-post-35.mail.demon.net ([194.217.242.85]) by mail4-smtp-sop.national.inria.fr with ESMTP; 19 Jan 2008 07:50:56 +0100 Received: from orion.metastack.com ([80.177.38.218]) by anchor-post-35.mail.demon.net with esmtp (Exim 4.67) id 1JG7Xb-000IFe-IS for caml-list@yquem.inria.fr; Sat, 19 Jan 2008 06:50:55 +0000 Received: from countertenor (mobileweb06.london.02.net [193.113.235.172]) (authenticated bits=0) by orion.metastack.com (8.13.4/8.13.3) with ESMTP id m0J6anUq013979 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Sat, 19 Jan 2008 06:36:57 GMT From: "David Allsopp" To: References: <20080119143259.46752d11.mle+ocaml@mega-nerd.com> Subject: RE: [Caml-list] Concatenation of static strings? Date: Sat, 19 Jan 2008 06:50:31 -0000 Organization: MetaStack Solutions Ltd. Message-ID: <000501c85a67$9e7cf5e0$6c7ba8c0@countertenor> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 Thread-Index: AchaShqTPvX5m8m0QQGNlbXNou4a0wAHNSAg In-Reply-To: <20080119143259.46752d11.mle+ocaml@mega-nerd.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-Scanned-By: MIMEDefang 2.63 on 172.16.28.218 X-Spam: no; 0.00; compiler:01 compiler:01 endline:01 lexer:01 semantics:01 endline:01 cheers:01 beginner's:01 ocaml:01 bug:01 burns:98 config:01 config:01 beginners:01 compile:01 I don't know whether the compiler optimises the concatenation (it ought to, just as constant integer arithmetic ought to be evaluated by the compiler), but how about writing: let print_usage () = print_endline "\n\ Usage : progname [options]\n\ \ progname [options] " Which is less typing. I use this for long SQL statements in code, as well. Note that you must escape the first space on the line if you want any spaces after it to count (the lexer semantics for \CR or \LF ignore whitespace at the start of the next line). David -----Original Message----- From: caml-list-bounces@yquem.inria.fr [mailto:caml-list-bounces@yquem.inria.fr] On Behalf Of Erik de Castro Lopo Sent: 19 January 2008 03:33 To: caml-list@yquem.inria.fr Subject: [Caml-list] Concatenation of static strings? Hi all, I find myself doing things like the following: let print_usage () = print_endline ( "\n" ^ "Usage : progname [options]\n" ^ " progname [options] \n" ) and wondering, when those strings are concatenated. Is that done at compile time? Cheers, Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- The difference between a violin and a viola is that a viola burns longer. _______________________________________________ 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