From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: "Christoph Höger" <christoph.hoeger@tu-berlin.de>
Cc: OCaML List Mailing <caml-list@inria.fr>
Subject: Re: [Caml-list] Expansion of type-constructors in ctype.ml
Date: Wed, 26 Aug 2015 10:26:01 +0900 [thread overview]
Message-ID: <24A57847-DEB0-4E99-9C95-E32BA41E88AE@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <55DC8E2A.7030101@tu-berlin.de>
On 2015/08/26 00:47, Christoph Höger wrote:
>
> Am 25.08.2015 um 16:02 schrieb Jacques Garrigue:
>> Do you mean that modifying moregen and eqtype (but not unify)
>> in a conservative way would be enough to solve your problem?
>
> At least until now, it seems to solve it. I can compile my ~12k classes
> in ~20min now. I expect the number of classes to decrease while I
> optimize the output of my compiler and their size to increase while I
> add more features. So the best bet is that the performance will stay the
> same, unless I encounter some more performance problems.
>
> Btw: Is there a place/format to discuss concrete proposed patches? This
> list seems to be more on the user's side.
The standard place would be a problem report on Mantis.
Performance problems are perfectly valid.
However, I think this stills falls in the scope of this list too, as the problem is wide enough.
But opening a PR on Mantis is useful for future reference.
>> Then indeed we could do that.
>> At least your code for eqtype seems fine. For moregen, this is not sufficient, due to non-local side effects.
>> By the way, we should keep your example around to prevent regressions.
>
> Feel free to add the example wherever you want. I can also open a bug in
> mantis if you think that is appropriate. Do you have any insights on
> what could be done for moregen?
The only safe way I see is to use the variance information.
I’ll look into that when I have some time.
>> You should read the following paper:
>> http://www.math.nagoya-u.ac.jp/~garrigue/papers/injectivity.pdf
>
> Thanks. Will do.
>
>> may_pos and may_neg are both unset (i.e. nothing is set) => no need to recurse
>> inj is set => must recurse
>> otherwise => must expand
>
> Sounds like inj is what I want for my concrete case. I recon there is no
> flag yet to manually set it. Do you know of a trick to force the
> inference mechanism to do so?
You don’t have to set it. It’s inferred automatically for all type definitions.
When you look up a type with Env.find_type, you get the variance as a field of the result.
The you can check whether Inj is set by [Variance.(mem Inj v)].
You can check if there is no occurence with [v = Variance.null].
> And by "no need to recurse" you mean that this argument could be left
> out (i.e. replaced by unit)?
Yes. No need to compare, since it would never be visited after expansion.
Jacques Garrigue
next prev parent reply other threads:[~2015-08-26 1:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-22 7:42 Christoph Höger
2015-08-22 9:23 ` Jeremy Yallop
2015-08-22 11:41 ` Christoph Höger
2015-08-23 22:18 ` Jacques Garrigue
2015-08-24 6:22 ` Christoph Höger
2015-08-24 10:15 ` Christoph Höger
2015-08-25 14:02 ` Jacques Garrigue
2015-08-25 15:47 ` Christoph Höger
2015-08-26 1:26 ` Jacques Garrigue [this message]
2015-11-05 11:29 ` Goswin von Brederlow
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=24A57847-DEB0-4E99-9C95-E32BA41E88AE@math.nagoya-u.ac.jp \
--to=garrigue@math.nagoya-u.ac.jp \
--cc=caml-list@inria.fr \
--cc=christoph.hoeger@tu-berlin.de \
/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