Hello
Here is the latest Caml Weekly News, for the week of September 12 to 19, 2006.
I hope this posting is appropriate for the email list. I got some advice on the #ocaml IRC channel that it would be fine :) Galois is seeking a full-time candidate for software development and systems integration in the field of high assurance computing. A successful candidate should have a good understanding of the inner workings of databases, good development skills in a number of languages, including at least one functional language (preferably Haskell), and web development. The candidate should have excellent Linux and Unix skills. If the candidate does not know Haskell, they should be good at learning new programming languages, and can reasonably expect to be fluent in Haskell within a few months. Tasks: * Database analysis * Python and PHP web development * Learning and adapting Linux-related technologies including Xen, SELinux, and Knoppix * Creating or modifying Debian packages * Haskell development Knowledge: * Databases implementation internals * Web development, Services-Oriented Architectures * Fluent in Haskell or other functional languages * Grounding in computer security * XML * Linux and Unix Nice-to-have: * Extreme Programming (XP) development experience * Experience deploying software products * Open source software development experience * Ability to get US security clearance Education: * Masters degree or equivilent experience Please respond with a resume and a cover letter explaining your fit to jobs@galois.com. Feel free to forward to interested parties.
> Can I do something like:
> class base_model = object(self)
> method from_array ary = ...
> end ;;
> class user = object(self)
> inherit base_model
> ...
> end ;;
> let finder sql class_type =
> query_database sql ;
> let res = new class_type in
> res#from_array res ;;
> let users = finder "SELECT * FROM users" user in
> xxx yyy ;;
> Ok. That is not working code, prob has syntax errors as well, but you
> get my idea. The problem I am having is passing the class to the
> generic finder method.
No, you can't, but you can pass the class constructor in place, which
is just equivalent.
let finder sql class_new =
query_database sql ;
let res = class_new () in
res#from_array res ;;
let users = finder "SELECT * FROM users" (fun () -> new user) in
xxx yyy ;;
Note that in general the class constructor takes arguments, so you
don't need the above anonymous function.
Here is the promised followup with more details on the slow safe
unmarshalling. On
http://www.cs.ru.nl/~tews/nsUnicodeToTeXCMRt1.i.oast you can
download 281 KB of marshalled data. On my machine it takes 23
seconds to check with native code.
The data is of type
annotated translationUnit_type = annotated * annotated topForm_type list
You can test it with the following piece of code:
open Cc_ast_gen_type
open Ast_annotation
let file = "/home/tews/src/elsa/elsa/in/big/nsUnicodeToTeXCMRt1.i.oast"
;;
try
SafeUnmarshal.from_channel
[^ annotated translationUnit_type ^]
(open_in file);
print_endline "OK"
with
| _ -> print_endline "FAIL"
compile with
ocamlopt.opt safeUnmarshal.cmxa ast_annotation.ml elsa_util.ml \
ml_ctype.ml cc_ml_types.ml cc_ast_gen_type.ml justunmarshal.ml
The additional files are from Olmar, get them here:
http://www.sos.cs.ru.nl/cgi-bin/~tews/olmar/viewvc-patch.cgi/elsa/elsa/ast_annotation.ml?revision=olmar-release-2006-09-07
http://www.sos.cs.ru.nl/cgi-bin/~tews/olmar/viewvc-patch.cgi/elsa/elsa/elsa_util.ml?revision=olmar-release-2006-09-07
http://www.sos.cs.ru.nl/cgi-bin/~tews/olmar/viewvc-patch.cgi/elsa/elsa/ml_ctype.ml?revision=olmar-release-2006-09-07
http://www.sos.cs.ru.nl/cgi-bin/~tews/olmar/viewvc-patch.cgi/elsa/elsa/cc_ml_types.ml?revision=olmar-release-2006-09-07
http://www.sos.cs.ru.nl/cgi-bin/~tews/olmar/viewvc-patch.cgi/elsa/elsa/cc_ast_gen_type.ml?revision=olmar-release-2006-09-07
To produce graphs like http://www.cs.ru.nl/~tews/marshal-plot.eps
you need to download Olmar, compile it and then
- ./regrtest -ocaml in subdir elsa
- ./regtest-oast | grep time >data in subdir asttools
- gnuplot plot
where the plot file is something like
reset
set grid
unset mouse
set terminal x11 persist
#set terminal postscript enhanced color
set xlabel "size (Bytes)"
set ylabel "time (s)"
set key left
z = 2.1
plot "data" using 6:3 title "SafeUnmarshal user time", \
(0.000017088 * x) ** 2.1
Archive: http://groups.google.com/group/fa.caml/browse_thread/thread/945e1328494273d/952cdfdeb7627407
Chris King asked and Jacques Garrigue answered:> I remember hearing somewhere that by exposing .cmx files, the compiler > is able to inline across module boundaries, and thus distributing .cmx > files is desirable. Is this just a myth? It seems redundant since > the .cmx files are included in the .cmxa anyway. This is a frequent confusion. The .cmxa does not contain all the information from the .cmx, in particular not the inlining information. This is natural if you think of it: when you compile a module, you have no way to know in which library are its dependencies, so you can only look for .cmx's, not for .cmxa's. The .cmxa's are only used at link time. You can still compile without the .cmx's, but you loose the optimizations.
It is our pleasure to announce the release of OCaml version 3.09.3.
This is mainly a bug-fix release, see the list of changes below.
It is available at the following URL:
http://caml.inria.fr/download.en.html
Happy hacking,
-- Damien Doligez for the OCaml team.
Objective Caml 3.09.3:
----------------------
Bug fixes:
- ocamldoc: -using modtype constraint to filter module elements
displayed
in doc PR#4016
- ocamldoc: error in merging of top dependencies of modules PR#4007
- ocamldoc: -dot-colors has no effect PR#3981
- ocamdloc: missing crossref in text from intro files PR#4066
- compilers: segfault with recursive modules PR#4008
- compilers: infinite loop when compiling objects PR#4018
- compilers: bad error message when signature mismatch PR#4001
- compilers: infinite loop with -rectypes PR#3999
- compilers: contravariance bug in private rows
- compilers: unsafe cast with polymorphic exception PR#4002
- native compiler: bad assembly code generated for AMD64 PR#4067
- native compiler: stack alignment problems on MacOSX/i386 PR#4036
- stdlib: crash in marshalling PR#4030
- stdlib: crash when closing a channel twice PR#4039
- stdlib: memory leak in Sys.readdir PR#4093
- C interface: better definition of CAMLreturn PR#4068
- otherlibs/unix: crash in gethostbyname PR#3043
- tools: subtle problem with unset in makefile PR#4048
- camlp4: install pa_o_fast.o PR#3812
- camlp4: install more modules PR#3689
New features:
- ocamldoc: name resolution in cross-referencing {!name}: if name is not
found, then it is searched in the parent module/class, and in
the parent
of the parent, and so on until it is found.
- ocamldoc: new option -short-functors to use a short form to display
functors in html generator PR#4017
- ocamlprof: added "-version" option
Here is a quick trick to help you read this CWN if you are viewing it using vim (version 6 or greater).
:set foldmethod=expr
:set foldexpr=getline(v:lnum)=~'^=\\{78}$'?'<1':1
zM
If you know of a better way, please let me know.
If you happen to miss a CWN, you can send me a message and I'll mail it to you, or go take a look at the archive or the RSS feed of the archives.
If you also wish to receive it every week by mail, you may subscribe online.