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

Re: [MirageOS-devel] How to implement protocols?



SeeÂhttp://www.cis.upenn.edu/~bcpierce/papers/modules-icfp.psÂfor more on this.

The alternative it provides is sharing-by-specification. This requires your implementations to pick a concrete instance of the module you're abstracting over (for instance in slide 42, the implementation of B has "A:AI = A"). I guess the point is you can swap out the concrete A that has been selected, but is there a practical way to do that in OCaml? AFAICT this would require a link-time hack. Also, this approach pollutes all of your signatures, so I don't immediately see it as a win, but I'd be curious to see some real world examples.ÂAre there any OCaml projects using this approach?

FWIW, my feeling is that the Cohttp code is hard to read not because of the functorization, but the lack of it. A deliberate choice was made to make the Lwt and Async versions non-uniform to support the differing styles of those two libraries. If it was fully functorized, there would be a single signature and single implementation that could be more easily followed.


On Fri, Nov 13, 2015 at 10:43 AM, Daniel BÃnzli <daniel.buenzli@xxxxxxxxxxxx> wrote:
Le vendredi, 13 novembre 2015 Ã 15:22, Hannes Mehnert a Ãcrit :
> I personally find the cohttp and TCP/IP code hard to read due to the use
> of lots of functors / module abstractions, which are not necessarily
> needed IMHO.

Not only they are not needed, it's also the wrong way of handling this as it is well known that factoring out module dependencies as functors doesn't scale in practice. The question to ask yourself for using a functor is: do I need multiple instances of the functor in *the same program* â good examples: {Map,Set}.Make.

See http://www.cis.upenn.edu/~bcpierce/papers/modules-icfp.ps for more on this.

Best,

Daniel



_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel

_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel

 


Rackspace

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