Skip to content

a simple, short refactoring of lambda/Matching.do_compile_matching#13342

Merged
gasche merged 1 commit intoocaml:trunkfrom
gasche:matching-refactor-do_compile_matching
Jul 31, 2024
Merged

a simple, short refactoring of lambda/Matching.do_compile_matching#13342
gasche merged 1 commit intoocaml:trunkfrom
gasche:matching-refactor-do_compile_matching

Conversation

@gasche
Copy link
Copy Markdown
Member

@gasche gasche commented Jul 30, 2024

This refactoring-only PR shares about 5 common arguments between 8 different function calls inside the pattern-matching compiler. This makes it sensibly easier to tweak the arguments passed to pattern-matching compilation (in the context of The Pattern-Matching Bug). This commit was extracted from #13154. It is short and requires no domain-specific knowledge, so it should be easy to review.

@redianthus
Copy link
Copy Markdown
Member

It looks correct to me and this is a clear improvement in terms of readability.

@gasche
Copy link
Copy Markdown
Member Author

gasche commented Jul 31, 2024

This needs the approval of a maintainer to move forward.

(compile_match ~scopes repr partial)
partial divide combine ctx pm
in
let open Patterns.Head in
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
let open Patterns.Head in

This local open isn't needed here and made the change slightly harder to review.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think that the person who wrote this open (probably me?) wanted to avoid relying on type-based disambiguation of constructors that are not in the lexical scope, a feature I still have mixed feelings about. I'll go with the easiest option of changing nothing at all here.

@gasche
Copy link
Copy Markdown
Member Author

gasche commented Jul 31, 2024

Thanks @zapashcanon and @yallop!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants