[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] pretty charts from OCaml and js_of_ocaml

On Fri, Jun 19, 2015 at 4:47 PM, Anil Madhavapeddy <anil@xxxxxxxxxx> wrote:
> On 19 Jun 2015, at 16:44, Daniel BÃnzli <daniel.buenzli@xxxxxxxxxxxx> wrote:
>> Le vendredi, 19 juin 2015 Ã 16:06, Anil Madhavapeddy a Ãcrit :
>>> The notebook (or perhaps toploop_js to be more specific?) predicate
>>> does seem like the right way to do things, despite the OASIS tooling
>>> issue.
>> Actually I prefer the addition of a package PKG.notebook. The less we put in 
>> META files the happier I am.
>> I have now personally settelled on the following scheme for toploops in my 
>> packages: requiring a package should only load the package and never have 
>> any other side effect.
>> If you want to have toploop support for the package you provide a PKG.top 
>> package that requires PKG and does its toplevel business. This seems to 
>> better match user expectations (see [1] for a discussion) and it could end 
>> up being annoying that you are not able to #require a package without having 
>> its side effect on the toplevel. Examples are if packages end up installing 
>> conflicting printers, or if a package automatically opens it's namespace 
>> like gg does and you dont' want that.
>> See for example the current toploop support for gg [2] which doesn't use any 
>> special predicate in the meta file.
> That makes sense to me.  I'm just not sure about the 'notebook' name.  Would 
> 'top_js' or something similar be more familiar given the existing set of 
> names?

The printers for iocaml use specific functions from it's library so
wont be compatible elsewhere.  I quite like 'notebook' as a
(subpackage) name, though would be happy to use 'iocaml' instead.

Also, there isn't really a distinction between iocaml (bytecode) and
iocamljs here.  Generally html based printers will work in both.  Ok,
there are some special things you can only do in iocamljs, but
generally only with js_of_ocaml specific libraries (like ocaml-c3).

Anyhow, a prototype c3 notebook binding using a subpackage;


and demo derived from the examples;


The tricky bit is actually how to load the d3 and c3 javascript
libraries - iocaml (server) cant do that at the moment.  I hacked it
into the HTML for the online demo but even that wasn't trivial as
things get weird in the presence requirejs.


MirageOS-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.