caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] ANN: simplified BER MetaOCaml N102, for OCaml 4.02.1
@ 2015-01-09  5:34 oleg
  2015-01-10 17:55 ` Jeremy Yallop
  0 siblings, 1 reply; 2+ messages in thread
From: oleg @ 2015-01-09  5:34 UTC (permalink / raw)
  To: caml-list


BER MetaOCaml is a strict superset of OCaml, adding operations to
construct and run typed code values. BER MetaOCaml N102 is the new
version, which is source _and_ binary compatible with OCaml
4.02.1. That is, staging-annotation-free BER MetaOCaml is identical to
OCaml; BER MetaOCaml can link to any OCaml-compiled library (and
vice versa); findlib and other tools can be used with BER MetaOCaml as
they are, in their binary form.

On the surface, BER N102 has hardly changed from the earlier BER N101.
All BER N101 code should work with the new version as it was. The
users may however notice better printing: of code, error messages and
cross-stage-persistent values. The implementation however has changed
quite a bit, extensively relying on attributes and bringing MetaOCaml
very close to OCaml. It is now a distinct possibility that -- with
small hooks that may be provided in the future OCaml versions --
MetaOCaml becomes just a regular library or a plug-in, rather being a
fork. (Please see below for details.)

The staging annotations are: 
    bracket: .< e >.  to delay computation (to the future stage)
    escape:  .~ e     to perform a computation e and splice-in the result
    run:     !. e     to run a future-stage computation, or code, now

A special type constructor, called 'code' builds the type of
future-stage computations, or code expressions:
    # .< 2 + 4 >.;;
    - : int code = .<2 + 4>. 
For more details, 
        http://okmij.org/ftp/ML/MetaOCaml.html#using


BER MetaOCaml N102 is available:

-- as a set of patches to the OCaml 4.02.1 distribution. 
        http://okmij.org/ftp/ML/ber-metaocaml-102.tar.gz
See the INSTALL document in that archive. You need the source
distribution of OCaml 4.02.1, see the following URL for details.
        http://ocaml.org/install.html

-- as a GIT bundle containing the changes relative to OCaml 4.02.1
        http://okmij.org/ftp/ML/metaocaml.bundle
First, you have to obtain the base
       git clone https://github.com/ocaml/ocaml.git -b 4.02.1 ometa4
and then apply the bundle.

The older, N101 version, is available via OPAM. The new version will
come to OPAM, hopefully soon.

Although on the surface BER N102 is almost the same as the earlier
version, internally it is quite different. To give the idea of the
difference, it is instructive to compare the amount of changes BER
MetaOCaml makes to the OCaml distribution. The old BER N102 modified
32 OCaml files. The new BER N102 modifies only 7 (that number could be
further reduced to only 2; the only file with nontrivial modifications
is typecore.ml). The patch size was 49729 bytes before and 34066 bytes
now.

The principal change is the extensive use of attributes, the new
feature of OCaml 4.02. Staging annotations -- brackets, escapes and
CSP -- are now really annotations: attributes on the Parsetree and
Typedtree. MetaOCaml also uses a Typedtree attribute to mark
non-expansive nodes (the non-expansiveness check is performed before
the bracket-translation but is used only after). An attribute on
value_description tells the staging level of the value.

There is no longer a separate Typedtree traversal pass, after the type
checking, to translate brackets and escapes. That means that for
staging-annotation-free code, MetaOCaml has no substantial overhead.
BER N102 has started on revamping cross-stage-persistence; quite a few
CSP have become printable and, mainly, serializable. Non-serializable
CSP were the only impediment to native MetaOCaml.

For more explanations, please see
        http://okmij.org/ftp/ML/MetaOCaml.html
as well as ChangeLog and NOTES.txt in the BER MetaOCaml distribution.

Hopefully the release of BER MetaOCaml N102 would further stimulate
using and researching typed meta-programming -- and perhaps merging
of MetaOCaml into the mainstream OCaml.



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

* Re: [Caml-list] ANN: simplified BER MetaOCaml N102, for OCaml 4.02.1
  2015-01-09  5:34 [Caml-list] ANN: simplified BER MetaOCaml N102, for OCaml 4.02.1 oleg
@ 2015-01-10 17:55 ` Jeremy Yallop
  0 siblings, 0 replies; 2+ messages in thread
From: Jeremy Yallop @ 2015-01-10 17:55 UTC (permalink / raw)
  To: Oleg Kiselyov; +Cc: Caml List

On 9 January 2015 at 05:34,  <oleg@okmij.org> wrote:
> BER MetaOCaml N102 is available:
>
> -- as a set of patches to the OCaml 4.02.1 distribution.
>         http://okmij.org/ftp/ML/ber-metaocaml-102.tar.gz
> See the INSTALL document in that archive. You need the source
> distribution of OCaml 4.02.1, see the following URL for details.
>         http://ocaml.org/install.html
>
> -- as a GIT bundle containing the changes relative to OCaml 4.02.1
>         http://okmij.org/ftp/ML/metaocaml.bundle
> First, you have to obtain the base
>        git clone https://github.com/ocaml/ocaml.git -b 4.02.1 ometa4
> and then apply the bundle.
>
> The older, N101 version, is available via OPAM. The new version will
> come to OPAM, hopefully soon.

BER MetaOCaml N102 is now also available via OPAM and can be installed
as follows:

   opam update
   opam switch 4.02.1+BER
   eval `opam config env`

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

end of thread, other threads:[~2015-01-10 17:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-09  5:34 [Caml-list] ANN: simplified BER MetaOCaml N102, for OCaml 4.02.1 oleg
2015-01-10 17:55 ` Jeremy Yallop

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