Hello
Here is the latest Caml Weekly News, for the week of August 23 to 30, 2011.
Archive: https://sympa-roc.inria.fr/wws/arc/caml-list/2011-08/msg00182.html
Vincent Balat announced:Position available: Ocaml/Ocsigen research engineer The IRILL [3] and the PPS laboratory [2] is hiring a Research Engineer with good skills in (Ca)ML programming for 1 year. Keywords: Ocsigen, Web applications, content management, OCaml Task: The engineer will join the Ocsigen [1] development team, as member of the ANR national project PWD (Programmation du Web Diffus). The work will take place in the new research center on free/open source software (IRILL) [3] in Paris. He will participate in the development of various components of the Ocsigen framework: - implementation of higher level tools for creating Web site easily (content management, Ocsimore project) - extensions and improvements to the Web server - library for writing graphical interfaces in OCaml in a browser - Ocsigen on mobile phones - Ocsigen and cloud computing About Ocsigen: Ocsigen is an open source framework to develop client/server Web applications fully in OCaml, as a single program. About PPS: PPS is an A-ranked CNRS laboratory of the University Paris Diderot Paris 7. One of its main research topics is the the study of programming languages and distributed systems and their logical foundations. The research activity is associated with an important software development activity, mainly in OCaml (for example Menhir, Unison). The main themes span from the Web (Ocsigen, CDuce, Xduce, Polipo) to parallel programming (Lwt, OcamlP3L, CPC), from networks (Babel) to the management of software packages (Debian, Edos, Mancoosi) and proof assistants (Coq). About the IRILL: The IRILL is a new international research centre on free/open source software located in Paris. IRILL's objective is to become a reference center for the research and development of stable and reliable free software. By hosting development projects, IRILL also acts as an observatory and experimental centre for transfer using free software. Required skills: - Expertise in OCaml programming - Knowledge of Web standards - Engineer or PhD degree (master may be sufficient under conditions) Contacts: Vincent Balat and Jérôme Vouillon: {Vincent.Balat || Jerome.Vouillon} @pps.jussieu.fr [1] http://www.ocsigen.org [2] http://www.pps.jussieu.fr [3] http://www.irill.org
Archive: https://sympa-roc.inria.fr/wws/arc/caml-list/2011-08/msg00185.html
Continuing the thread from last week, Jeffrey Scofield said:> > I'd be happy to hear from anybody interested in OCaml on iOS. > > Thanks for this - will endeavour to look more closely into it. > I'm curious as to whether Apple would approve an app written in OCaml > for the app store. I was under the impression that they wouldn't. Apple dropped their restrictions on languages for iOS around a year ago. The press release is still available here: http://www.apple.com/pr/library/2010/09/09statement.html We (Psellos) are selling an app written in OCaml in the app store right now, in fact. It's called Cassino, and plays a card game. At the risk of too much self-promotion, here is a link: http://itunes.apple.com/us/app/cassino/id411381417 We've had no trouble getting versions of the app approved by Apple. (Granted, we're not a big enough player to merit a lot of scrutiny.) When we started porting OCaml to iPhone, it was with the attitude of doing something slightly crazy, but it has worked out pretty well. I think OCaml has real advantages for writing iOS apps, and it has also been more fun and interesting than the usual coding for the "mobile space".
Archive: https://sympa-roc.inria.fr/wws/arc/caml-list/2011-08/msg00193.html
Henri Binsztok announced:It is our pleasure to announce to the Caml List that Opa is now an open source project! - Opa is a new programming language for writing web/cloud applications. It is a functional, statically typed language, with native support for the web. For instance: Create XML fragments values: line = <div class="line"></div> Access elements of the DOM: Dom.scroll_to_bottom(#conversation) - Opa manages all aspects of a distributed web application (including the database) within a single technology and runtime: Just compile Opa code to standalone binaries that run the web application server. - Opa manages client and server code within one language. The compiler decides (you can hint) which parts run on the client and on the server, automatically generates JavaScript code for the client part and automates all communications. - Most of Opa is implemented in OCaml (around 200k LoCs). We're thankful to the OCaml community for providing such a great technology to write Opa and would love your feedback on Opa. We're also setting up a Developer Challenge. Submit your application and win some new hardware! Links: - Opa project home: http://opalang.org - Opa source code: https://github.com/MLstate/opalang - Opa developer challenge: http://opalang.org/challenge/home.xmlt
Archive: https://sympa-roc.inria.fr/wws/arc/caml-list/2011-08/msg00206.html
Chris Yocum asked and Jacques Garrigue replied:> A friend of mine is giving a talk about "monkey patching" entitled > "Monkey patching, subclassing, and accidental overriding" > (http://aaroncrane.co.uk/talks/monkey_patching_subclassing/paper.html). > I was wondering how Ocaml deals with this situation or if it is even a > problem at all in Ocaml? I mocked up some code: > > class base = > object > method meth x = > print_endline "base"; > print_endline (string_of_int x) > end > > class deriv = > object > inherit base > method meth x = > print_endline "deriv"; > print_endline (string_of_int x) > end > > which kind of(?) shows the problem in Ocaml. He suggests in his paper > that using a Meta-Object Protocol is the way around this. What do you > think? You can require overriding to be explicit by activating warning 7: $ ocaml -w +7 OCaml version 3.13.0+dev6 (2011-07-29) # class c = object method x = 1 end;; class c : object method x : int end # class d = object inherit c method x = 2 end;; Warning 7: the method x is overridden. class d : object method x : int end Note also that in ocaml a method only has one signature, so the problems with API changes doesn't apply here: you get an error if the type changed in the base class, and a warning if the method name was changed in the base class. However, in this respect I think that a "final" keyword is missing in ocaml. Namely, you have no way to say that you don't want subclasses to modify a method (because you want to be able to redefine it yourself, for instance). But OCaml is not an object-only language, so if you want this kind of guarantee you can use functors: specify exactly what the user should provide, without allowing a posteriori overriding.Gerd Stolpmann also replied:
I think it is a non-issue in practice. Simply because inheritance is quite seldom in Ocaml, even in programs using a lot of OO features. There is an attractive alternative, namely passing functions down to change the behavior of objects. So, you would normally define class base ?meth () = object method meth x = match meth with | None -> print_endline "base"; print_endline (string_of_int x) | Some f -> f x end class deriv = base ~meth:(fun x -> print_endline "deriv"; print_endline (string_of_int x) ) () You'd do something like this for all mutable behavior (maybe you wouldn't use individual functions for overriding, but some more elaborate data structure). Of course, this is generally a less powerful technique, but you often don't need the full power of inheritance. This is attractive for getting more control, and looks less like patching the algorithms of the base class. Also, you don't need inheritance in Ocaml for declaring subtyping relations. So, it is entirely possible to avoid the "inherit" keyword, and have nevertheless a lot of object-oriented design.Jacques Garrigue later said:
There are lots of things in this discussion. A first point I would like to make clear: objects are used in ocaml, and quite a lot. You just have to look at the code available. I see them often used to wrap some state, in IO or GUIs. However they are not that much used for what they are often used in C++: program structuring. (There are exceptions: ocamldoc uses lots of inheritance) If you want just to structure your program, modules are better in most cases. There are still situations where classes are stronger than modules for structuring: * when you have a default for some operation, but want to be able to change it * when you want to mix components, using multiple inheritance and virtual methods and instance variables Also, for various reasons, objects are not beginner friendly. I think the main problem is that they don't fit that well with type inference: both subtyping and polymorphic methods require explicit type annotations. This is worse than having long error messages: correct programs (at least programs that would be correct in a really principal type system) get refused for reasons that are hard to understand for beginners. For this reason and others, I think that both objects and polymorphic variants are mostly useful in library design, where you give the user a protocol to use them. This greatly reduces the risk of getting into trouble. On the other hand, I don't think many features are missing from the point of view of expressivity. As I mentioned in my previous mail, ocaml now has an override keyword, and it is a hard error to override a non-defined method. All warnings can be turned into errors, and when programming with objects it is a good idea to activate the ones disabled by default. Concerning friend methods, it is indeed possible to block access at the method level, but I would rather suggest using private rows: module Cell : sig type cell = private < get: int; give: cell -> unit; .. > val create : int -> cell end = struct class cell x = object (_ : 'cell) val mutable x = x method get = x method set y = x <- y method give (c : 'cell) = x <- x - 1; c#set (c#get + 1) end let create = new cell end You cannot inherit from cell, but I would believe this is not a problem in most situations. I see nothing strange in privacy control being at the module level: protected in Java is also at the package level rather than the class level. And it is better not to duplicate functionality. I won't really enter the discussion about information hiding. Encapsulation is central to OO, but whether it is information hiding or not is an open issue :-)
Archive: https://sympa-roc.inria.fr/wws/arc/caml-list/2011-08/msg00222.html
Michel Lévy asked and Benoit Montagu replied:> I want to insert some Ocaml expressions in latex, but by cut/paste it's > impossible, because I lose > the identation. > Do you have a solution to insert Ocaml source in latex document ? > Do you know if someone has written a definition for using ocaml with the > listings package ? It might not be up to date, but there is one that is included in the default listings package. \lstset{ language=[Objective]Caml } should work.Maxence Guesdon also suggested:
You may have a look at highlight: http://www.andre-simon.de/doku/highlight/en/highlight.htmlMichel Lévy then said:
Thank you all, for your answers to my questions. But for my limited needs, I have also seen that cut/paste was a solution, if, in emacs, you replace the tabs by spaces. For example, M-x untabify replaces in a selected region the tabs by spaces.
Archive: https://sympa-roc.inria.fr/wws/arc/caml-list/2011-08/msg00230.html
Gerd Stolpmann announced:A new version of Ocamlnet has been released: Version 3.4 mainly focuses on smaller usability improvements: - Ocamlnet has been ported to IPv6 (or better, this project is now done) - The apache module understands now a NetcgiRequire directive which works in the same way as #require in the toploop. - The methods read_file and write_file have been added to the Netfs.stream_fs abstraction for accessing filesystems. These methods allow it to avoid temporary files in some cases. - Netplex prints now line numbers when emitting messages about errors in the config file. Plus some smaller changes (see ChangeLog). The project page with all relevant links (manual, download, etc): http://projects.camlcity.org/projects/ocamlnet.html GODI for Ocaml-3.12 is already updated.
Thanks to Alp Mestan, we now include in the Caml Weekly News the links to the recent posts from the ocamlcore planet blog at http://planet.ocamlcore.org/. JavaLib and Sawja Javalib 2.2.1 a: http://caml.inria.fr/cgi-bin/hump.cgi?contrib=319 Zarith 1.0: http://caml.inria.fr/cgi-bin/hump.cgi?contrib=788 data Maybe -- harmful?: http://blog.dbpatterson.com/post/9528836599 Opa advocacy: http://dutherenverseauborddelatable.wordpress.com/2011/08/28/opa-advocacy/ Opa on Lambda the Ultimate (and now Slashdot): http://dutherenverseauborddelatable.wordpress.com/2011/08/28/opa-on-lambda-the-ultimate/ Type fascism..: http://blog.rastageeks.org/ocaml/article/type-fascism ocaml random string and word generation: http://www.rktmb.org/post/2011/08/25/ocaml-random-string-and-word-generation
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.