caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jordan W <jordojw@gmail.com>
To: Andrew Herron <thespyder@programmer.net>
Cc: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] CommonML: An opinionated build/package/develop workflow on top of CommonJS
Date: Tue, 24 Feb 2015 21:58:24 -0800	[thread overview]
Message-ID: <CAPOA5_4i3rkcy0L35EhdjD7pHuiRaHzBFFvw-t+hEYJxVheeYQ@mail.gmail.com> (raw)
In-Reply-To: <CALATSMb6dDmCbMemo=7BCUnTjg8VdVLknBmqOyLmhQ6kyz2GDQ@mail.gmail.com>

There's certainly a lot of ideas/experiments in CommonML all rolled
into one. The overarching goal was to just explore the ideal developer
flow for people who are either used to CommonJS or who appreciate a
highly sandboxed development model without globals. There's some
"pointless" goodies thrown in like zero effort merlin support and
automatic doc generation (which is now being solved in a *much* better
way by other people more knowledgeable than myself).

CommonML is just a hacky script, but I find it useful to build
developer tools by starting with the ideal end developer experience
and performing whatever atrocious hacks I have to in order to create
it. After I get feedback, I can explore doing it the right way.
Obviously OPAM is the real deal, and I hope some people can help me
achieve much of this with OPAM (as it is, or in future versions).

But the most valuable part of the CommonML experiment, actually has
nothing to do with package managers/sandboxes at all - it's the
automatic namespacing of dependencies (using module aliases) and
automatic generation of merlin completion files. You literally only
have to list a new dependency in your `package.json`, then it will
resolve all naming conflicts, build correctly, and allow you to
immediately start autocompleting using merlin. I suspect such a
seamless experience is only feasible when there are opinionated
conventions in place. I feel like most people would be satisfied with
the ones explored in CommonML:
- namespaced dependencies, non-namespaced internal modules
(ModuleInsideMyPackage.x, YourPackage.ModuleInsideYourPackage.y) -
powered by module aliases.
- "exports" field in `package.json` that determines which modules
should be publicly available to other packages that depend on you
(nothing is visible to other packages by default).

I don't know enough about the OCaml build toolchain to solve this in a
scalable way so I made it work generally enough for a couple of the
projects that I'm prototyping. I hope the same can be achieved in some
other more sophisticated build tool. Has anyone seen anything like the
automatic namespacing I've prototyped here? I couldn't imagine
developing without it, personally.


On Tue, Feb 24, 2015 at 7:12 PM, Andrew Herron <thespyder@programmer.net> wrote:
> I've been thinking about this a bit, as a JS developer who is experimenting
> with OCaml (in my non-existant free time). I don't use the CommonJS flow in
> my day job although we do have many projects which our internal
> build/dependency system combines with similar results.
>
>
> On Wed, Feb 25, 2015 at 6:26 AM, Jordan W <jordojw@gmail.com> wrote:
>>
>>
>> I created a proof of concept called CommonML, which lets developers use
>> their familiar CommonJS workflow with OCaml:
>> https://github.com/jordwalke/CommonML
>
>
> My initial thoughts were to stick with the OPAM repositories; even if I have
> to make a local OPAM repo server it seems like leveraging the existing
> ecosystem is a good idea. My experiments use a dedicated `opam switch` for
> the project, enforced by the Makefile (which might not scale to multiple
> projects, but I haven't tried that yet).
>
> I can think of one good reason to share OCaml and JS dependencies on the
> same server though, and that's including a JS library in a js_of_ocaml
> project. Certainly using a single package.json file to specify both JS and
> OCaml dependencies is an interesting idea (even if under the hood we
> eventually find a way to use OPAM for the OCaml projects).
>
> Cheers,
> Andy

  reply	other threads:[~2015-02-25  5:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24 20:26 Jordan W
2015-02-25  3:12 ` Andrew Herron
2015-02-25  5:58   ` Jordan W [this message]
2015-02-25  6:24     ` Andrew Herron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPOA5_4i3rkcy0L35EhdjD7pHuiRaHzBFFvw-t+hEYJxVheeYQ@mail.gmail.com \
    --to=jordojw@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=thespyder@programmer.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).