[cwn] Attn: Development Editor, Latest OCaml Weekly News
Alan Schmitt
alan.schmitt at polytechnique.org
Tue Jan 29 05:42:19 PST 2019
Hello
Here is the latest OCaml Weekly News, for the week of January 22 to 29,
2019.
Table of Contents
─────────────────
ocaml-gemini 0.1
Godbolt compiler explorer beta now has OCaml support
Debugging memory issues
First release of Mssql
IFDEF conditional compilation and ocamlbuild
Old CWN
ocaml-gemini 0.1
════════════════
Archive: <https://discuss.ocaml.org/t/ann-ocaml-gemini-0-1/3221/1>
Carmelo Piccione announced
──────────────────────────
Hello, I'd like to announce the initial release of [ocaml-gemini], a
pure OCaml library that fully implements the [Gemini] [REST api] as
well as [market data] and [private order events] websocket apis.
For those unfamiliar, Gemini is a well established cryptocurrency
exchange launched by the notorious Winklevoss Twins (unfortunately the
exchange is written in Go, but I digress).
The implemention depends on `cohttp-async', `websocket-async', and
`yojson' for serialization support. `nocrypto' is used for the
session authentication. If there is sufficient interest by the
community I can extend the code to support a `lwt' version.
A console interface is also provided which accepts s-expressions as
parameters. It is mostly used to test the api or do quick and dirty
order management.
Finally, any feedback on the api or PRs are welcome, as usual.
[ocaml-gemini] <https://github.com/struktured/ocaml-gemini>
[Gemini] <http://gemini.com>
[REST api] <https://docs.gemini.com/rest-api/>
[market data] <https://docs.gemini.com/websocket-api/#market-data>
[private order events]
<https://docs.gemini.com/websocket-api/#order-events>
Godbolt compiler explorer beta now has OCaml support
════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/godbolt-compiler-explorer-beta-now-has-ocaml-support/3225/1>
Freyr666 announced
──────────────────
Feel free to test.
<https://ocaml.godbolt.org/beta/>
Debugging memory issues
═══════════════════════
Archive: <https://discuss.ocaml.org/t/debugging-memory-issues/3223/1>
Sean Talts asked
────────────────
I'm working on a [new compiler/transpiler] written in OCaml and we've
(unfortunately?) been using the Format library to emit the code that
we're generating. Today I'm just starting to run it on some huge test
programs and finding that it's taking up dozens of GB of memory pretty
quickly and totally swamping the machine only a little ways into the
program. I tried debugging with `ocamldebug' but I can't find any
specific code that's repeating too much or anything like that - it
just seems like something invisible is happening and my number one
suspect is that it's the building up of these long Format strings
(with nested "%a" compositional formatting). But I'd like to figure
out for sure so I don't waste time switching away from the Format
library or something if it's an unrelated issue.
Any help appreciated! Thanks :)
[new compiler/transpiler] <https://github.com/stan-dev/stanc3>
Jack Feser replied
──────────────────
You could give spacetime
(<https://blog.janestreet.com/a-brief-trip-through-spacetime/>) a
try. It's a new ocaml memory profiler. You'll need to install a
spacetime-specific compiler switch though.
Simon Cruanes then said
───────────────────────
In my experience, `Format' doesn't leak memory (if you use `fprintf'
into some IO channel; if you print into a buffer then the buffer might
grow, of course). It's pretty fast and very convenient. I second the
idea of using some form of profiling such as spacetime to find where
the leak comes from.
Christian Lindig replied
────────────────────────
I have not used it myself, but `Obj.reachable_words' reports the words
reachable from a given value. If you suspect some value already to be
responsible for the leak, you could observe it with this function.
Pierre Chambart also replied
────────────────────────────
I have debugged quite a few things with
<https://github.com/jhjourdan/ocaml/tree/memprof> . It is available in
the opam repository as ocaml-variants.4.07.1+statistical-memprof you
should use it with <https://github.com/jhjourdan/statmemprof-emacs>
First release of Mssql
══════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-first-release-of-mssql/3242/1>
Brendan Long announced
──────────────────────
I'm happy to announce the first [opam release] of [Mssql], our
FreeTDS-based Async SQL Server client library.
We've gone to some trouble to make it safer to use than direct
bindings to FreeTDS, with things like [parameterized queries],
workarounds for [insane logic in FreeTDS], and logic to throw
exceptions instead of crashing when you try to do things like [use a
closed DB handle].
We've also wrapped everything in background threads and [ensured that
any FreeTDS calls that perform IO release the runtime lock], so it's
safe to use in an Async app without blocking everything when you do DB
calls, and also ensured that if you attempt to use a connection
concurrently, [everything will just work] (although it won't be any
faster).
There's also [a built-in thread pool], although it has some annoying
limitations since FreeTDS doesn't give us low-enough-level control to
properly reset connections.
(We made this using Async since that's what we use, but contact me if
you want to add support for Lwt)
[opam release] <https://opam.ocaml.org/packages/mssql/>
[Mssql] <https://github.com/arenadotio/ocaml-mssql>
[parameterized queries]
<https://github.com/arenadotio/ocaml-mssql/blob/master/src/client.mli#L17>
[insane logic in FreeTDS]
<http://pymssql.org/en/stable/freetds_and_dates.html>
[use a closed DB handle]
<https://github.com/arenadotio/ocaml-mssql/blob/master/src/client.ml#L32>
[ensured that any FreeTDS calls that perform IO release the runtime
lock]
<https://github.com/arenadotio/ocaml-mssql/commit/d1a9ca2eaa818650368058501ad3d201f9854690>
[everything will just work]
<https://github.com/arenadotio/ocaml-mssql/blob/master/src/client.ml#L29>
[a built-in thread pool]
<https://github.com/arenadotio/ocaml-mssql/blob/master/src/client.mli#L79>
IFDEF conditional compilation and ocamlbuild
════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ifdef-conditional-compilation-and-ocamlbuild/3244/1>
Luc Bougé announced
───────────────────
I am developing a program in Ocaml for my Programming class.This idea
is to provide the students with various versions of the program, using
more and more complex techniques.
I would like to design a common master, and then derive the various
versions automatically using some conditional compilation facility.
I considered [camlp4 IFDEF] but it applies to complete expressions,
only. Instead, I would like to add or remove cases in long lists of
`if ... then ... else if ...'.
Also, I am using `ocamlbuild' and I cannot find how to define `IFDEF'
compilation tags in the compilation chain.
Is there any IFDEF-wizard in the community? :sunglasses:
[camlp4 IFDEF]
<http://caml.inria.fr/pub/docs/manual-camlp4/manual002.html>
Anton Kochkov replied
─────────────────────
See <https://github.com/ocaml-community/cppo> +
<https://jbuilder.readthedocs.io/en/latest/quick-start.html#using-cppo>
(for dune, since using plain ocamlbuild is "an old way of doing
things").
Anton Kochkov then added
────────────────────────
Note there is also <https://github.com/janestreet/ppx_optcomp> for
using only extension points (PPX)
Old CWN
═══════
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].
[Alan Schmitt]
[send me a message] <mailto:alan.schmitt at polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/caml-news-weekly/attachments/20190129/b45708d7/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: <http://lists.idyll.org/pipermail/caml-news-weekly/attachments/20190129/b45708d7/attachment-0001.pgp>
More information about the caml-news-weekly
mailing list