List Info

Thread: "ocaml_beginners"::[] Re: Using (sub)modules - fileutils for example




"ocaml_beginners"::[] Re: Using (sub)modules - fileutils for example
user name
2006-11-28 00:13:05

On 27-11-2006, Johann Spies < jspies%40sun.ac.za">jspiessun.ac.za> wrote:
&gt; On Mon, Nov 27, 2006 at 12:17:13PM +0000, Richard Jones wrote:
&gt;> On Mon, Nov 27, 2006 at 11:49:33AM +0200, Johann Spies wrote:
&gt;> > In fileUtil.mli I get:
>> > module type FILE_UTILS =
>>;
>> It's confusing isn't it ... Here FileUtil.FILE_UTILS is a module
&gt;> type, not an actual module. A module type is just a signature
>> (similar to an "interface" in Java) which defines the type of the
>&gt; functions and values in the module, but doesn't actually contain any
>&gt; code to implement those functions.
>>
>> I had to go and look at Sylvain's code to see that this module type is
>&gt; actually implemented by various concrete modules, including
>> FileUtil.StrUtil
>;> (http://sylvain.le-gall.net/ocaml-fileutils/FileUtil.StrUtil.html), so
>&gt; you would, it seems, need to use FileUtil.StrUtil.ls, or one of the
>&gt; other concrete modules.
>
> Thanks.
&gt;

Indeed. The reason for this : there is many different implementation of
regex (str, pcre...) I don't want to retain one, so i enable people to
use any. But it generates a more complicated code...

I should write a documentation

I recommend you to define, in a file common.ml, for example :
module MyFileutil = FileUtil.StrUtil;;

and then in function.ml :
open Common.MyFileutil;;

(so you will have a central place for Fileutil definition).

Regards,
Sylvain Le Gall

__._,_.___
.

__,_._,___
"ocaml_beginners"::[] Re: Using (sub)modules - fileutils for example
user name
2006-11-30 10:49:48

On Tue, Nov 28, 2006 at 12:13:05AM +0000, Sylvain Le Gall wrote:
&gt; I should write a documentation

That will help amateurs like me

>
> I recommend you to define, in a file common.ml, for example :
> module MyFileutil = FileUtil.StrUtil;;
>
> and then in function.ml :
> open Common.MyFileutil;;
>
> (so you will have a central place for Fileutil definition).
>

Thanks. That helps.

Now a further question showing that I do not program every day...

I can now do

# My.ls ".&quot;;;
- : FileUtil.filename list =
["./2006-11-06_134434.log"; "./xaa"; "./csvtool.ml&quot;; "./navraag.csv&quot;;
"./146.232.65.6-navraag.csv"; "./Makefile";; "./leesfw.ml&quot;; "./._d";
"./leesfw.mml&quot;; "./leesfw.mml~&quot;; "./Makefile~&quot;; "./leesfw.cmi&quot;;
"./leesfw.o";; "./leesfw.cmx&quot;; "./leesfw";
"./146.232.65.7-navraag.csv";
"./aanteken-navraag.csv&quot;; "./afteken-navraag.csv&quot;]

But how use something that requires types like test_file

e.g. I want to test whether a file has a zero byte size and you have a
type: test_file with the option Size_not_null.

How do I specify what I want to test on that file?

# My.test Size_not_null "xaa&quot;;; is obviously not working.

Regards
Johann
--
Johann Spies Telefoon: 021-808 4036
Informasietegnologie, Universiteit van Stellenbosch

";But grow in grace, and in the knowledge of our Lord
and Saviour Jesus Christ. To him be glory both now and
for ever. Amen."; II Peter 3:18

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )