Skip to content

Rec_info: Add coercions #317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

lukemaurer
Copy link

This is xclerc's work; making a PR to review it.

Add the Coercion constructor for simple expressions. So far, only the identity coercion exists, but part 2 of this line of work will add coercions that express that two bindings might refer to the same function but at different recursion depths (which we'll be tracking in the type).

@lukemaurer lukemaurer requested a review from lpw25 March 8, 2021 12:35
xclerc and others added 5 commits March 11, 2021 16:04
* Use `Coercion.t` rather than `Coercion.t option` in many places
* Use `Rec_info.t` again where sensible (in making inlining decisions,
  for instance), but redefine it as `unit` pending the next phase of
  `Rec_info` overhaul
* Add simple `int` fields to `Coercion.t` for changing recursion depth;
  this is simpler than what we'll actually need but specific enough that
  we can test meaningfully (e.g., we can tell whether coercions are
  composed in the right order)
@lukemaurer lukemaurer force-pushed the remove-rec_info-part-1 branch from bea20c4 to 29b5420 Compare March 11, 2021 16:17
@@ -18,6 +18,12 @@

[@@@ocaml.warning "+a-4-30-40-41-42"]

(* CR lmaurer: Maybe we should similarly have a type [canonical] isomorphic
to [Simple.t]? *)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly think it would be a nice thing to document this file a bit more. Right now it's hard to understand what [canonical] and [coercion] means in this context. Both terms are used extensively but are never introduced properly. It would also be good to explain the link between coercions and rec_info.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few (long) comments. There isn't really yet a link between coercions and rec_info, and even once the rec_info patch is in, the connection will simply be that changing rec_info is a variety of coercion (that just happens to be currently the only nontrivial one).

@lukemaurer lukemaurer marked this pull request as draft April 1, 2021 10:58
Also return Bottom from more places (generally anything involved in a
meet).
@lukemaurer lukemaurer force-pushed the remove-rec_info-part-1 branch from b851101 to 9816841 Compare April 1, 2021 12:24
@lukemaurer
Copy link
Author

I've split out PR #383 and PR #386. Marked this as a draft until they're in and I've rebased.

A `Name.Set.t` or `'a Name.Map.t` is a fine thing, but a `Simple.Set.t`
or `'a Simple.Map.t` is much sketchier, since whether we want to treat
two simples that differ only in `Rec_info.t` as equivalent depends on
context. Fortunately, we usually just need a set or map of names. The
one place where this gets tricky is in the uses of `Aliases.get_alias`,
so there's now `Aliases.Alias_set.t` to encapsulate the needed
operations.
Everything is now gone except for a few stragglers in `cmx/` and
`naming/`; these will be more easily dealt with after some changes to
`Simple.t`.
This reverts the parts of commit
9816841 that have been split off into
PRs ocaml#383 and ocaml#386, as well as the Bottom stuff (likely to be unnecessary
as we're considering making `Coercion.compose` a total function).
@lukemaurer lukemaurer marked this pull request as ready for review April 23, 2021 13:10
@lukemaurer
Copy link
Author

This has been split into #439 through #445 (thanks to @poechsel); closing this PR.

@lukemaurer lukemaurer closed this May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants