caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Martin Jambon <martin.jambon@ens-lyon.org>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Differences between Array and Strings
Date: Sat, 30 Apr 2011 16:10:51 -0700	[thread overview]
Message-ID: <4DBC96FB.1030703@ens-lyon.org> (raw)
In-Reply-To: <E51C5B015DBD1348A1D85763337FB6D972AB2CBE@Remus.metastack.local>

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 = <fun>
>>> # [...]
>>> # - : 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

  reply	other threads:[~2011-04-30 23:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fa.YVp+LBcZBn2VVSqyBV+/Bw0Mb/I@ifi.uio.no>
2011-04-30 11:03 ` Radu Grigore
2011-04-30 13:34   ` David Allsopp
2011-04-30 23:10     ` Martin Jambon [this message]
2011-04-29 11:51 louis.jachiet
2011-04-29 14:36 ` David Allsopp
2011-04-30 14:06 ` Philippe Wang

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=4DBC96FB.1030703@ens-lyon.org \
    --to=martin.jambon@ens-lyon.org \
    --cc=caml-list@inria.fr \
    /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).