caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] META file standards for native plugins
@ 2015-04-09 11:47 François Bobot
  2015-04-09 13:27 ` Gabriel Scherer
  0 siblings, 1 reply; 3+ messages in thread
From: François Bobot @ 2015-04-09 11:47 UTC (permalink / raw)
  To: OCaml Mailing List

Hi,

	Another topic which need a standard is native dynamic plugins. In fact there is a defacto standard 
(used by some libraries and tools, but not specified in ocamlfind documentation) but it is a bad one.

   archive(plugin,native) = "toto.cmxs"

It is a bad one because the semantic of META file says that the value of `archive(native)` can be 
return when you ask the value of `archive` with the predicate `plugin` and the predicate `native` true.

I discussed it with some people and the current proposition where

   * archive(plugin_native)
   * archive(plugin)
   * archive(shared)


I personally prefer the `shared` predicate because it corresponds to the `-shared` option of 
ocamlopt that creates `.cmxs`.

  The predicate `shared` would be added to ocamlfind documentation. The prospective `ocamlfind check 
META` could recommend to add an `archive(shared)` if the `archive(native)` exists. For a transition 
period `archive(plugin,native)` and `archive(shared)` would be both present in the META.


Thoughts or suggestions?


Best regards,

-- 
François Bobot

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] META file standards for native plugins
  2015-04-09 11:47 [Caml-list] META file standards for native plugins François Bobot
@ 2015-04-09 13:27 ` Gabriel Scherer
  2015-04-09 14:47   ` François Bobot
  0 siblings, 1 reply; 3+ messages in thread
From: Gabriel Scherer @ 2015-04-09 13:27 UTC (permalink / raw)
  To: François Bobot; +Cc: OCaml Mailing List

[-- Attachment #1: Type: text/plain, Size: 2063 bytes --]

I don't understand the problem with the current semantics. The .cmxs will
be linked when both predicates "archive" and "plugin" are true, and that
seems correct to me (we use this when we want to link a *plugin* inside a
*native* program). This is consistent with the use for example of
(syntax,preprocessor,camlp4o) and (syntax,preprocessor,camlp4r) to select
standard or revised syntax, or (syntax,toploop) when invoked from the
toplevel. Also many packages currently use archive(byte,plugin) as well
(which links to the .cma, just as with only archive(byte)).

On Thu, Apr 9, 2015 at 1:47 PM, François Bobot <francois.bobot@cea.fr>
wrote:

> Hi,
>
>         Another topic which need a standard is native dynamic plugins. In
> fact there is a defacto standard (used by some libraries and tools, but not
> specified in ocamlfind documentation) but it is a bad one.
>
>   archive(plugin,native) = "toto.cmxs"
>
> It is a bad one because the semantic of META file says that the value of
> `archive(native)` can be return when you ask the value of `archive` with
> the predicate `plugin` and the predicate `native` true.
>
> I discussed it with some people and the current proposition where
>
>   * archive(plugin_native)
>   * archive(plugin)
>   * archive(shared)
>
>
> I personally prefer the `shared` predicate because it corresponds to the
> `-shared` option of ocamlopt that creates `.cmxs`.
>
>  The predicate `shared` would be added to ocamlfind documentation. The
> prospective `ocamlfind check META` could recommend to add an
> `archive(shared)` if the `archive(native)` exists. For a transition period
> `archive(plugin,native)` and `archive(shared)` would be both present in the
> META.
>
>
> Thoughts or suggestions?
>
>
> Best regards,
>
> --
> François Bobot
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>

[-- Attachment #2: Type: text/html, Size: 2743 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] META file standards for native plugins
  2015-04-09 13:27 ` Gabriel Scherer
@ 2015-04-09 14:47   ` François Bobot
  0 siblings, 0 replies; 3+ messages in thread
From: François Bobot @ 2015-04-09 14:47 UTC (permalink / raw)
  To: Gabriel Scherer; +Cc: OCaml Mailing List

On 09/04/2015 15:27, Gabriel Scherer wrote:
> I don't understand the problem with the current semantics. The .cmxs will be linked when both
> predicates "archive" and "plugin" are true, and that seems correct to me (we use this when we want
> to link a *plugin* inside a *native* program). This is consistent with the use for example of
> (syntax,preprocessor,camlp4o) and (syntax,preprocessor,camlp4r) to select standard or revised
> syntax, or (syntax,toploop) when invoked from the toplevel. Also many packages currently use
> archive(byte,plugin) as well (which links to the .cma, just as with only archive(byte)).
>

When two sets predicate are incomparable you don't have the problem. The problem is when one is 
included in the other.

Just to recall, the semantic of ocamlfind define an applicable assignment as :

        *      An  assignment  can  only  be  used  if  all  positive formal predicates are
               included in the set of actual predicates, and if all negative formal  predi‐
               cates  are  not included in the set of actual predicates. Such an assignment
               is called applicable. If there is no such assignment, the variable will have
               no value.

When you ask for a set of predicate you want all the applicable assignment to make sense. If you ask 
for (syntax,preprocessor,camlp4o) you agree to receive the variable associated to 
(syntax,preprocessor) because it is more general. If you are compiling a multithreaded bytecode 
program the predicates are (byte, mt, mt_posix,...) you are happy to receive archive(byte).

But when you ask (plugin,native) you don't want to receive (native) because cmx can't be used for 
cmxs, so it should not be applicable. So you should not ask (plugin,native) but something 
incomparable with (native). Do you agree?

For bytecode, when looking for bytecode plugin we can ask for (byte,plugin) because we agree to 
receive (byte), and it is a good idea to allow people that have a specific version of their library 
for dynamic linking to define archive(byte,-plugin) and archive(byte,plugin). We can't use 
(byte,shared) because (shared) is then applicable.


-- 
François

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-09 14:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-09 11:47 [Caml-list] META file standards for native plugins François Bobot
2015-04-09 13:27 ` Gabriel Scherer
2015-04-09 14:47   ` François Bobot

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).