Skip to content
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

Do not use the transitive closure in generated META files #405

Merged
2 commits merged into from
Jan 12, 2018

Conversation

ghost
Copy link

@ghost ghost commented Jan 11, 2018

Currently, in META files jbuilder uses the transitive closure in requires and ppx_runtime_deps variables. I can't remember why I did that but it seems simpler not to do that.

The generated META files are smaller, It simplifies the code and in any case it's likely that using the transitive closure won't be compatible with library variants.

@ghost ghost force-pushed the simplify-meta-generation branch from 0f4adda to 8d2bbd9 Compare January 11, 2018 14:44
src/lib_db.ml Outdated
| x -> Inl [x]
| exception e ->
(* Call [find] again to get a proper backtrace *)
Inr { fail = fun () -> ignore (find_exn t ~from:dir name : Lib.t); raise e }
Copy link
Member

Choose a reason for hiding this comment

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

Would you mind explaining this trick a bit? How does calling find_exn again get us a proper back trace? Isn't it going to just raise and we won't re-raise e?

Copy link
Author

Choose a reason for hiding this comment

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

yes, that's the expectation. In fact we could just replace the raise e by assert false. By calling find_exn, we get a more precise backtrace. For instance it might start in findlib.ml

Copy link
Member

Choose a reason for hiding this comment

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

OK, I think doing assert false will be a little nicer since we won't even have to bind e in the pattern match.

List.map (String_set.elements required) ~f:(find_exn t ~from:dir)
with
| l -> Some l
| exception _ -> None)
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated: Maybe we should just add Option.try_with I see that we do this idiom in a few places already.

Copy link
Author

Choose a reason for hiding this comment

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

indeed

@ghost ghost merged commit e28344a into master Jan 12, 2018
@ghost ghost deleted the simplify-meta-generation branch January 15, 2018 14:59
This pull request was closed.
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.

2 participants