caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Benjamin Canou <benjamin.canou@gmail.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] OCamlPro Highlights: Dec 2013 & Jan 2014
Date: Thu, 06 Feb 2014 12:31:22 +0100	[thread overview]
Message-ID: <52F3728A.1010408@gmail.com> (raw)
In-Reply-To: <52F35934.5070306@inria.fr>

   Hi Romain,

Thanks for your reactive input. OCamlRes is still in design stage (cf. 
the version number) and I published it for gathering potential usages 
and users so it is very welcome. About the lack of mli, the 
implementation is actually ocamldoc'ed, so a `make doc` and a good 
browser should make for a reasonable substitute until the interface is 
well frozen in an mli.

For your filesystem overlay use case, this can already be done with a :

let load_resource base rpath =
   try
     OCamlRes.(Res.find Path.(of_string rpath) MyResources.root)
   with Not_found ->
     let fp = open_in (base ^ rpath) in
     (* read fp *)

But I agree that it could be generated automatically in a specific format.

Your idea of a master file makes sense. I'm more in favor of polishing the CLI for filtering files, but I think both approaches can coexist.

I will put a todo / ideas list on github and I invite you (as well as everyone else) to contribute :)

Cheers,
   Benjamin.

Le 06/02/2014 10:43, Romain Bardou a écrit :
> 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,
>


  parent reply	other threads:[~2014-02-06 11:31 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
2014-02-06 10:25   ` Malcolm Matalka
2014-02-06 10:57     ` Anil Madhavapeddy
2014-02-06 11:31   ` Benjamin Canou [this message]
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=52F3728A.1010408@gmail.com \
    --to=benjamin.canou@gmail.com \
    --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).