caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Hongbo Zhang <bobzhang1988@gmail.com>
To: oleg@okmij.org
Cc: caml-list@inria.fr
Subject: [Caml-list] Re: Call for collaboration on the future of camlp4
Date: Sat, 22 Sep 2012 08:02:03 -0400	[thread overview]
Message-ID: <505DA8BB.1080009@gmail.com> (raw)
In-Reply-To: <20120922075008.24778.qmail@www1.g3.pair.com>

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

On 9/22/12 3:50 AM, oleg@okmij.org wrote:
>> Yes, it's [MetaOCaml] a run-time optimizer with type safe assurance. It can do
>> partial evaluation to generate some optimized code.
> Let me stress once again how narrow this view is. MetaOCaml goes well
> beyond partial evaluation. For example, MetaOCaml, as a general code
> generation framework, was used to derive optimal (in the number of
> multiplications) FFT kernels. Partial evaluation will not give you
> that.
>
> Code generation is a very promising technique in High-Performance
> computing. Most of the tools used in practice -- FFTW, ATLAS, SPIRAL
> -- are all off-line tools. They generate a large number of candidate
> codes and choose the best performing. What's important is to quickly
> generate a large number of very tedious programs. Assurance of
> correctness are important: a programmer, especially a domain expert,
> will not want to even look at the generated code let alone debug it.
> I see MetaOCaml target the same area.
>
To my limited knowledge, FFTW used techniques more like Camlp4.
Again: type safety(without dependent types) is far from correctness,
actually, the type error bugs are the easiest to fix. In practice,
you always need to debug the generated code if something goes wrong.
One thing people complains about template c++ code is that it's really
hard to debug.

>> I agree it would be useful to have a native eval, but this requires
>> non-trivial changes to the compiler which I don't expect it will be
>> realized in a short term.
> The assessment is mistaken. MetaOCaml v3.09 did have a native
> back-end. I know quite well what changes were required. Those changes
> are no longer needed since dynamic linking has since become part of
> OCaml proper.
Actually, I am one of the curious programmers who tried MetaOCaml and 
played
with it. Don't get me wrong, I would be happy to see MetaOCaml pushed 
into OCaml.
As I said before, it's orthogonal to P4, it's great if we could 
dynamically generate
type safe code, and we can make use of meta-ocaml as well ;-)
But the assumption is /*that we have a native meta-ocaml without 
patching the compiler */
>> If you take a look at the history of Template Haskell, they finally
>> step back from type checking everything to give up type checking some
>> quasi-quotations.
> This is a mistaken impression. While Template Haskell as a whole will
> remain untyped for a long time -- after all, Template Haskell can
> generate data and type class _declarations_, whose typing is far from
> clear -- there is a definite push towards MetaOCaml-like type safety
> for expressions.
>    http://hackage.haskell.org/trac/ghc/blog/Template%20Haskell%20Proposal
>
> see especially
>    Part B: Add new MetaML-style constructs for strongly-typed metaprogramming.
>
> If this is implemented, TH becomes quite like MetaML.
There are two problems here, first you object language is not only ocaml,
second, yes, we want /*everything to be first class, everything*/, the most
expressive system.
>> We don't want to sacrifice too much experssivity for type safety, this
>> is especially important in macros. In common lisp, there is also a
>> kind of macros called "Anaphoric macros" which you will find painful
>> to do in Scheme.
> That is not a very good argument since R5RS macros in Scheme were
> intentionally limited in their expressivity. The macro system was
> designed to be just enough expressive for the special forms
> introduced in the Report. (Later on the system was found to be quite
> more expressive than its designers have anticipated.)
>
> The anaphoric macros are easily expressible in the system of our JFP
> 2011 paper (staging with a very limited delimited control). No
> subversions of hygiene are needed.
That depends on how you define 'easily expressible' ;-)
Let's discuss in private, btw, it's a bit unfair that you just picked
some points and ignored others without context.

Thanks for your message.
>


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

  reply	other threads:[~2012-09-22 12:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-20  9:36 [Caml-list] " oleg
2012-09-20 12:16 ` [Caml-list] " Hongbo Zhang
2012-09-22  7:50   ` oleg
2012-09-22 12:02     ` Hongbo Zhang [this message]
2012-09-22 12:53     ` Jacques Carette
2012-09-22 13:13       ` Hongbo Zhang
  -- strict thread matches above, loose matches on Subject: below --
2012-09-18 19:11 [Caml-list] " bob zhang
2012-09-19 19:55 ` Wojciech Meyer
2012-09-19 21:21   ` [Caml-list] " Hongbo Zhang
2012-09-19 21:35     ` Hongbo Zhang
2012-09-30 17:02 ` bobzhang

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=505DA8BB.1080009@gmail.com \
    --to=bobzhang1988@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=oleg@okmij.org \
    /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).