From: "Christoph Höger" <christoph.hoeger@tu-berlin.de>
To: caml users <caml-list@inria.fr>
Subject: [Caml-list] Avoiding type unfolding
Date: Sat, 28 Nov 2015 13:32:06 +0100 [thread overview]
Message-ID: <56599EC6.90204@tu-berlin.de> (raw)
Dear all,
I asked about this back in August but only now I had the time to get
back at the issue. Consider the following script:
#!/usr/bin/bash
echo "class ['t] c_0 (t:'t) = object method child = t end" > c_0.ml
for x in {1..15}; do
((y = $x - 1)) ;
echo "class ['t] c_$x (t:'t) = object method child_2 = ((new
C_$y.c_$y) t) method child_1 = (new C_$y.c_$y) t end" > c_$x.ml
/usr/bin/time ocamlc.opt -c c_$x.ml
done
It demonstrates that type unfolding during the check of
implementation/interfaces generates an exponential runtime. The problem
is that each constructor is parametric and has to be expanded in order
to access the normal form of its rhs. This is done for each element in
the hierarchy.
Is there any trick, hack or encoding that enables compilation of the
same (or equivalent) classes in constant time?
thanks,
Christoph
--
Christoph Höger
Technische Universität Berlin
Fakultät IV - Elektrotechnik und Informatik
Übersetzerbau und Programmiersprachen
Sekr. TEL12-2, Ernst-Reuter-Platz 7, 10587 Berlin
Tel.: +49 (30) 314-24890
E-Mail: christoph.hoeger@tu-berlin.de
reply other threads:[~2015-11-28 12:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=56599EC6.90204@tu-berlin.de \
--to=christoph.hoeger@tu-berlin.de \
--cc=caml-list@inria.fr \
/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