caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Romain Bardou <romain.bardou@inria.fr>
To: Fabrice Le Fessant <fabrice.le_fessant@ocamlpro.com>
Cc: Ocaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] OCamlPro Highlights: Dec 2013 & Jan 2014
Date: Thu, 06 Feb 2014 10:43:16 +0100	[thread overview]
Message-ID: <52F35934.5070306@inria.fr> (raw)
In-Reply-To: <CAHvkLrNGNze=R3PO4b6DSs+ZR2KzQCjxuM5GXLXGV9oCFWqkew@mail.gmail.com>

On 05/02/2014 18:31, Fabrice Le Fessant wrote:
> Hi,
> 
>   Here is the link to OCamlPro's report on its activities in January
> 2014 on OCaml:
> 
> http://www.ocamlpro.com/blog/2014/02/05/monthly-2014-01.html
> 
> --Fabrice
> 

Interesting read.

Regarding OCamlRes...

- It like the idea. I already have one use case: images for my GTK icons.

- There is no .mli in your src directory, it makes your code less
readable (even empty .mli files are interesting, they tell the reader
that the module is the main module).

- Because of the above I was not able to find out what ocplib-ocamlres
provided.

- Maybe this is handled by ocplib-ocamlres, but it would be nice if
there was a way to include resources in the executable at first, and
then, if the project becomes bigger, have a way to externalize (some of)
those resources without changing the code. So we would have some
function such as:

  val load_resource: string -> string

taking the resource path (e.g. "res/a/x/test.int") and returning the
contents of the file, either by actually reading an external file, or
just by returning a string which was included at compile-time. It could
be as simple as:

let load_resource path =
  try
    Hashtbl.find included_resources path
  with Not_found ->
    let ch = open_in path in
    ...

where included_resources is a hash table filled by ocp-ocamlres. (I
don't think it is very interesting to keep the directory hierarchy, but
maybe it is for some use cases.)

- I would probably write a file containing the list of resource files I
want to include (one per line), and in my build system, add a rule
saying how to obtain an .ml file from it using ocp-ocamlres. It would
protect the user from including trash such as Emacs autosaves (~ files —
although mines are in a different directory :) ) or Windows Thumbs.db
files or whatever. You can't be sure what's inside your "res" directory!
Maybe your tool could read such a file itself to make it easier and more
unified.

Cheers,

-- 
Romain Bardou

  reply	other threads:[~2014-02-06  9:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-05 17:31 Fabrice Le Fessant
2014-02-06  9:43 ` Romain Bardou [this message]
2014-02-06 10:25   ` Malcolm Matalka
2014-02-06 10:57     ` Anil Madhavapeddy
2014-02-06 11:31   ` Benjamin Canou
2014-02-06 13:06     ` Daniel Bünzli
2014-02-06 16:07       ` Benjamin Canou
2014-02-07  1:36         ` Benjamin Canou
2014-02-07 10:48           ` Daniel Bünzli
2014-02-06 10:53 ` Pierre-Étienne Meunier
2014-02-07  9:15   ` Alain Frisch

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=52F35934.5070306@inria.fr \
    --to=romain.bardou@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=fabrice.le_fessant@ocamlpro.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).