Hello
Here is the latest OCaml Weekly News, for the week of January 20 to 27, 2015.
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2015-01/msg00112.html
Continuing this old thread, Arnaud Spiwack asked and Yoann Padioleau replied:> Could you give the relevant commands to be used in an ocaml > project (in particular, it seems that `scheck -lang ml` fails with > "unsuported language") ? You first need to build the graph code database. But for that you need to have the .cmt files generated for your project. You can generate them just like you generate the .annot by modifying your makefile, e.g. by adding -bin_annot to OCAMLCFLAGS for instance. Once the .cmt are here, do ~/pfff/codegraph -lang cmt -build /path/to/your/project then you can use ~/pfff/scheck -lang cmt /path/to/your/project
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2015-01/msg00115.html
Tao Stein announced:I am pleased to announce the release of my new work "A Thousand, a Billion, a Trillion", which I believe to be the largest image ever created (at over one terapixel). I am letting you folks know because I coded and rendered it entirely using OCaml (well with a tiny bit of bash script controllers thrown in). The global work is segmented into 1,024 unique tiles, individually watermarked, and linked to the RPC interface of my Hong Kong gallerist for authenticity checks. If you want to own one of the works just add "shitaoweekly" on the Chinese phone app WeChat and enter in "one trillion" at the text interface. If you have any problems, email me. I relish any opportunity to give back to the OCaml community, in the ways I am most able. This work is gaining substantial attention and interest within the Chinese art world (in Beijing, where I work), and already some level of international interest. If you are interested in details, my gallerist's press release here describes the work and also mentions the importance of the OCaml system and community to this work: ENGLISH: http://sigma.gallery/TaoStein_NewWork_Sigma_201501_en.pdf CHINESE: http://sigma.gallery/TaoStein_NewWork_Sigma_201501.pdf
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2015-01/msg00118.html
Daniel Bünzli announced:I'd like to announce the release of Uutf 0.9.4 which should be available shortly in opam. You'll only be interested if you want to count bytes or if you are using the utftrip utility distributed with the package. Details in the release notes: https://github.com/dbuenzli/uutf/blob/v0.9.4/CHANGES.md#v094-2015-01-23-la-forclaz-vs Uutf is a non-blocking streaming Unicode codec for OCaml. Homepage: http://erratique.ch/software/uutf
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2015-01/msg00134.html
Hannes Mehnert announced:Off-the-record is a cryptographic protocol which is mainly used for instant messaging. It provides encryption and authentication (plus forward secrecy), uses AES128-CTR mode for encryption, SHA256 (and SHA1 for MACs) and DSA for public/private keys, lots of DH computation in oakley 5 (1536 bit). In addition to the authenticated encrypted channel OTR features the socialists millionaires problem (SMP) - to authenticate the other party using a shared secret over an already established channel (without exposing that shared secret, using some zero knowledge proofs). I implemented this protocol, both version 2 and 3, in OCaml and am happy to have an initial release (0.1.0, 2 clause BSD licensed), already in the opam repository. I'd be glad to receive feedback regarding coding style (similar to TLS - immutable data, monadic error passing, API does not expose any exceptions) etc. Code: https://github.com/hannesm/ocaml-otr OTR: https://en.wikipedia.org/wiki/Off-the-Record_Messaging Protocol spec: https://otr.cypherpunks.ca/Protocol-v3-4.0.0.html SMP: https://en.wikipedia.org/wiki/Socialist_millionaire
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2015-01/msg00142.html
Ben Millwood announced:Well, this has been a long time in the pipeline. 112.06 was delayed first by competing with other priorities, then by the winter holidays, then by some mixups with the release process and some build issues on OS X and 32-bit Linux. It's now finally ready for general consumption! (shortly to be superseded by the 112.17 release anyway, oh well.) The following packages were upgraded: - async - async_extended - async_extra - async_kernel - async_unix - bignum - bin_prot - core_bench - core - core_extended - core_kernel - custom_printf - jenga - ocaml_plugin - pa_bench - patdiff - re2 - sexplib - textutils - typerep Files for this release are available on our website and all packages are in opam: https://ocaml.janestreet.com/ocaml-core/112.06/individual/ Unfortunately, the documentation generator has still not been fixed. I'm hopeful it will be soon. The full changelog: ### async_extended - Unwound a recent change to `Mailbox` where one invocation of `receive` would put aside items, preventing other invocations from noticing them. - Added `Delimited.Row.nth_conv_exn`, as a counterpart to `get_conv_exn`. - Fixed `File_updates` handling of identical mtimes. ### async_extra - In `Log`, exposed the raw message. - Changed `Rpc` creators' `connection_state` to be a function that takes the connection and returns the state. This makes it possible for the connection state to actually get a handle on the connection itself, which simplifies a number of idioms for using RPC. In particular, it makes it easier to respond with an RPC back to a client over client's own connection. - Fixed some nondeterministically failing tests. - In `Log`, made logs discard messages when their output list is empty. Also, removed redundant tracking of current level. - Moved `Udp.bind_to_interface_exn` to `Unix` module in `async_unix`. - Added `Versioned_typed_tcp.Repeater`. Repeater is used in the cases where we want to inspect and possibly alter the flow between a client and a server without having to change either the client or the server or the protocol between them. ### async_kernel - Added `Deferred.Sequence` module, analogous to `Deferred.List` but for `Core_kernel.Std.Sequence`. - Modernized code style. ### async_unix - Added `Writer.behave_nicely_in_pipeline`, which makes a program behave nicely when used in a shell pipeline where the consumer goes away. - Modernized code style. - Removed spurious overrides in `Signal`: `set` and `signal`. These overrides are no longer necessary because the functions moved from `Core.Signal` to `Core.Signal.Expert`. - Moved `async_extra`'s `Udp.bind_to_interface_exn` to `Unix`. ### bignum - Added functions to round from `Bignum.t` to `Bigint.t`, and to convert `Bigint.t` into `Bignum.t`. ### bin_prot - Sped up `float` and `float array` operations. - Removed a use of `Obj.magic` in code generated by `pa_bin_prot` for polymorphic variants that led to memory unsafety. Previously, `pa_bin_prot` generated this kind of code for polymorphic variants: match Obj.magic (read_int buf pos) with | `A as x -> x | `B as x -> x | `C -> `C (read_float buf pos) | _ -> fail and this caused the compiler to assume the result is an immediate value. To fix this we removed the `as x -> x` and used the computed integer hash. ### core - Renamed `Linux_ext.gettid` as `Unix.gettid`, and added OpenBSD support. `SYS_gettid` is not available on OpenBSD, but is used in `Core_extended`. See the mailing list discussion about this here: https://groups.google.com/forum/#!topic/ocaml-core/51knlnuJ8MM Seems like the OpenBSD alternative is: pid_t getthrid(void); although it's not defined in any header file, which is a bit unfortunate. - Added `Piecewise_linear.precache`, which computes a lookup table that speeds up subsequent calls to `Piecewise_linear.get`. - Added `Time_ns` module, representing times as 63-bit integers of nanoseconds since the epoch. - Fixed build of `unix_stubs.c` on OpenBSD. - In `Daemon`, fixed an error message regarding `WSTOPPED` (fixes #47). - Added `Time.Span.Stable.V2`, with sexps that use new suffixes for microseconds (`us`) and nanoseconds (`ns`). `Time.Span.of_string` supports the new format, but `Time.Span.to_string` doesn't yet produce it -- we plan to change that later, after the new `of_string` has made it out more widely. - Added `Time.Span.to_string_hum`, which gives more options for rendering time spans. - Merged the `recvmmsg` stubs in `Bigstring` and `Iobuf`. Factored out a shared underlying `recvmmsg` call that both stubs use. Restored `-pedantic` by avoiding a C99 feature (variable-length stack arrays). - Made `Date.t` abstract, and changed its representation from a 4-word record to an immediate int (packing year, month, day). - In `Daemon`, changed the permissions of the `std{err,out}` files generated during daemonization from `0o777` to `0o644`. - Moved `Thread_safe_queue` from `core` to `core_kernel`. This was done so that `Async_kernel` can use it, eliminating one of `Async_kernel`'s dependencies on `Core`. `Thread_safe_queue_unit_tests` remains `Core`, at least for now, because it has some dependencies on other stuff in `Core`. ### core_bench - Solved a problem in which OCaml 4.02 was optimizing away benchmarks, making them meaningless. ### core_extended - Sped up `String.is_substring` by replacing the OCaml implementation with a call to libc `memmem`. `memmem` runs in 20% of the time, incurs minimal GC pressure, is portable among UNIXen that we target, AND it's clearer than the ML version. - Made `Float_ref` support `bin_io` and `sexp`. - Removed `gettid`, which is now available in `Core.Unix`. - Added `Fast_int_div` module, which speeds up integer division by a fixed divisor. - Moved `Sexp.of_sexp_allow_extra_fields` to core_kernel. ### core_kernel - Made `String_id` have `Stable_containers.Comparable`. - Changed `Gc.disable_compaction` to require an `allocation_policy`. - Made `Option` match `Invariant.S1`. - Added `Sequence.filter`, `compare`, and `sexp_of_t`. - Added `With_return.with_return_option`, abstracting a common pattern of `with_return`. val with_return : ('a return -> 'a ) -> 'a val with_return_option : ('a return -> unit) -> 'a option - Install a handler for uncaught exceptions, using `Printexc.set_uncaught_exception_handler`, new in OCaml 4.02. - Changed `Day_of_week` representation to a normal variant. - Changed `Exn.handle_uncaught` so that if it is unable to print, it still does `exit 1`. - Added `Sexp.of_sexp_allow_extra_fields`, previously in `Core_extended.Sexp`. - Changed the implementation of `Exn.raise_without_backtrace` to use `raise_notrace`, new in OCaml 4.02. - Added `Float` functions for converting to and from IEEE sign/exponent/mantissa. - Added `String.Caseless` module, which compares and hashes strings ignoring case. - Reimplemented `Type_equal.Id` using extensible types (new in OCaml 4.02), removing a use of `Obj.magic`. Changed `Type_equal.Id.same_witness` to return `option` rather than `Or_error`, which allows it to be implemented without allocation. - Removed a reference to the `Unix` module. Applications using `core_kernel` should be able to link without `unix.cma` again. - Made `Char.is_whitespace` accept `\f` and `\v` as whitespace, matching C. ### jenga - Support for user control of stale-artifact deletion, by allowing specification of an artifact-determination policy. - Expose jenga's internal (and better - only quotes when necessary) definition of `Shell.escape` in `Api` - Removed `Action.shell` from the API, superseded by `Action.process`. - Changed RPC interface as needed for build manager to switch from scraping error messages to RPCs. - Fixed jenga's per-rule memo table, which mistakenly kept stale values. - Show what target is being demanded, useful for debugging rules. - Run user action when persistent format changes. - When filtering buildable targets by globs, pay attention to the kinds allowed by the glob. Specifically, if the kinds don't include `` `File `` (i.e. only include `` `Directory ``) then we should not see any `buildable_targets` in the filtered list. ### ocaml_plugin - Stopped using the `~exclusive` with `Reader`, because it doesn't work on read-only file systems. It's not even needed because these files are written atomically. - Used a generative functor in the generated code, so the user code can apply generative functors at toplevel, or unpack first class modules that contain type components. - Fixed bug when mli file references something defined only in another ml. - Made it possible to compile a plugin in one process, and dynload the compiled `cmxs` file without starting async in another process. This was done with two new APIs in `Ocaml_dynloader.S`: val compile_ocaml_src_files_into_cmxs_file : dynloader -> string list -> output_file:string -> unit Deferred.Or_error.t val blocking_load_cmxs_file : string -> t Or_error.t - Allowed plugins to optionally have a shebang line. - Made `Ocaml_dynloader.find_dependencies` also support files with shebang lines. ### pa_bench - Made the code generated by `pa_bench` for `BENCH` not use `ignore`, because OCaml 4.02 will remove dead code in some cases, meaning the benchmarks are no longer measuring what they should. Instead the ignore is deep inside `Core_bench`, which is likely out of reach of the compiler. The result of the user functions given to `BENCH_FUN` and `BENCH_INDEXED` are changed so they don't have to return unit and people are encouraged not to use `ignore` when these functions don't return `unit` (you will get the same warning though, i.e. a warning if the result of your function is a function too, thus preventing unintended partial applications). For example, here are a few benchmarks and their output before the fix: let x = if Random.bool () then 100 else 1001 let r = ref 0 BENCH "ig-1" = 10 / x BENCH "ig-2" = () BENCH "ig-3" = phys_equal (10 / x) (Obj.magic 0) BENCH "ig-4" = r := (10 / x) BENCH "ig-5" = r := x +----------------+----------+------------+ | Name | Time/Run | Percentage | +----------------+----------+------------+ | [misc.ml] ig-1 | 3.92ns | 29.30% | | [misc.ml] ig-2 | 3.34ns | 24.95% | | [misc.ml] ig-3 | 3.91ns | 29.23% | | [misc.ml] ig-4 | 13.37ns | 100.00% | | [misc.ml] ig-5 | 3.24ns | 24.20% | +----------------+----------+------------+ Many of the the numbers above are much lower than they should be because of the implicit ignores inserted by the benchmark caused the division to to eliminated by the compiler. After the fix, the same benchmarks produced more meaningful numbers: +----------------+----------+------------+ | Name | Time/Run | Percentage | +----------------+----------+------------+ | [misc.ml] ig-1 | 12.78ns | 94.55% | | [misc.ml] ig-2 | 3.23ns | 23.90% | | [misc.ml] ig-3 | 13.51ns | 99.94% | | [misc.ml] ig-4 | 13.52ns | 100.00% | | [misc.ml] ig-5 | 3.30ns | 24.40% | +----------------+----------+------------+ ### sexplib - Improved the implementation of `Exn.sexp_of_t`, using the unique id in exceptions in OCaml 4.02. We use the identifier to map exception constructors to converters. --- We hope you find it useful! -- Ben, on behalf of the Core team
Thanks to Alp Mestan, we now include in the OCaml Weekly News the links to the recent posts from the ocamlcore planet blog at http://planet.ocaml.org/. Fast vectorizable math functions approximations: http://gallium.inria.fr/blog/fast-vectorizable-math-approx Further OCaml GC Disharmony: http://psellos.com/2015/01/2015.01.gc-disharmony-bis.html Recursive Memoize & Untying the Recursive Knot: http://typeocaml.com/2015/01/25/memoize-rec-untying-the-recursive-knot/ Securing the Unikernel: http://roscidus.com/blog/blog/2015/01/21/securing-the-unikernel/ Left-recursive versus right-recursive lists in LR parsers: http://gallium.inria.fr/blog/lr-lists Mutable: http://typeocaml.com/2015/01/20/mutable/ Brewing MISO to serve Nymote: http://amirchaudhry.com/brewing-miso-to-serve-nymote
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.