caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Daniel Bünzli" <daniel.buenzli@erratique.ch>
To: Gabriel Scherer <gabriel.scherer@gmail.com>
Cc: Ocaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] Safe UTF-8 string literals and pattern matching for OCaml
Date: Fri, 1 May 2015 22:42:04 +0200	[thread overview]
Message-ID: <C3DC6B285633420FB79BF6A60F4118CC@erratique.ch> (raw)
In-Reply-To: <CAPFanBH4QB8jMM1a=Rm0+N+dVcCrT8RMOfUMmfJQPqTuU28D5A@mail.gmail.com>

Le vendredi, 1 mai 2015 à 22:13, Gabriel Scherer a écrit :
> I wonder whether a system based on extensions [%u "..."] rather than attributes "..." [@u] could be easier to extend in the future. For example, you might want to introduce a different annotation `u16` that generates an integer array representing an utf16-encoded literal (or an abstract type of your liking, but then not in pattern position). Having an annotation change the type of the code would not be very nice.

I don't think that multiplying *representations* is a good idea and a single canonical one should be eventually chosen for this in OCaml. So personally I'm not interested in that kind of extension.

In any case desugaring the same notation to integer arrays is part of the design space I consider (though if we imagine a compiler integration it would be much less convenient). But I would never use UTF-16 for that. Using Unicode scalar values directly is less costly and leads to a conceptually correct type from a Unicode processing point of view.

Best,

Daniel



  reply	other threads:[~2015-05-01 20:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-01 18:15 Daniel Bünzli
2015-05-01 20:13 ` Gabriel Scherer
2015-05-01 20:42   ` Daniel Bünzli [this message]
2015-05-01 21:19     ` Daniel Bünzli

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=C3DC6B285633420FB79BF6A60F4118CC@erratique.ch \
    --to=daniel.buenzli@erratique.ch \
    --cc=caml-list@inria.fr \
    --cc=gabriel.scherer@gmail.com \
    /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).