From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p3UN9kMd011685 for ; Sun, 1 May 2011 01:09:46 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqEAAGmWvE1CbwQakWdsb2JhbACYEj+NRhQBAQEBCQsLBxQEIcQDBYYAhhKNBIop X-IronPort-AV: E=Sophos;i="4.64,294,1301868000"; d="scan'208";a="98411379" Received: from out2.smtp.messagingengine.com ([66.111.4.26]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 01 May 2011 01:09:41 +0200 Received: from compute4.internal (compute4.nyi.mail.srv.osa [10.202.2.44]) by gateway1.messagingengine.com (Postfix) with ESMTP id DA7F02334F for ; Sat, 30 Apr 2011 19:09:39 -0400 (EDT) Received: from frontend1.messagingengine.com ([10.202.2.160]) by compute4.internal (MEProxy); Sat, 30 Apr 2011 19:09:39 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=message-id:date:from:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; s=smtpout; bh=twOn0s3ccZxFDBC3ZN7/nlrtKsI=; b=QqoYf+4HPcTBJGeqTIbBGntkEe2WWYCyzeBfWhZi/hRs1mSVGnWKYDc1itGPTIrVljlzQxP/b8vLHXDzO0GpQt7cA7YgJTHcIHAarnt3w9+cnNej2mWF0WkoOLknIr8+O6y9GYw/+Q32o2JLogfYlJwbYFXKOSB5aUxj2QmxYbA= X-Sasl-enc: vOymmxo5eOj4CJMdwItYTy6TN6rG6imSWYyoF7T0MkGQ 1304204979 Received: from [192.168.2.3] (c-98-248-39-171.hsd1.ca.comcast.net [98.248.39.171]) by mail.messagingengine.com (Postfix) with ESMTPSA id 7CB11401637 for ; Sat, 30 Apr 2011 19:09:39 -0400 (EDT) Message-ID: <4DBC96FB.1030703@ens-lyon.org> Date: Sat, 30 Apr 2011 16:10:51 -0700 From: Martin Jambon User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20101023 Lightning/1.0b3pre Thunderbird/3.1.3 MIME-Version: 1.0 To: caml-list@inria.fr References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] Differences between Array and Strings On 04/30/11 06:34, David Allsopp wrote: > Radu Grigore wrote: >> On Friday, April 29, 2011 12:51:59 PM UTC+1, louis....@ens.fr wrote: >>>> let l () = "1" ;; >>>> [...] >>>> l()==l();; >>> # val l : unit -> string = >>> # [...] >>> # - : bool = true >> >> Is there a good reason for this behavior? > > Whether it's good is debatable, but in most instances you don't want a fresh string being allocated each time for a constant value as it would be a waste of time and memory (most strings are used immutably). I concur. And the strings that we mutate are buffers which are not created from string literals anyway. Martin