Skip to content

refactor: move coq scopes to own module#10181

Merged
rgrinberg merged 1 commit intomainfrom
ps/rr/refactor__move_coq_scopes_to_own_module
Mar 22, 2024
Merged

refactor: move coq scopes to own module#10181
rgrinberg merged 1 commit intomainfrom
ps/rr/refactor__move_coq_scopes_to_own_module

Conversation

@rgrinberg
Copy link
Copy Markdown
Member

@rgrinberg rgrinberg commented Mar 1, 2024

cc @ejgallego and @Alizter . I need to refactor OCaml scope handling in dune and it would be helpful to have the coq stuff live on its own. No semantic changes here, but I did remove some intermediate lazy cells whose purpose I did not see.

@rgrinberg rgrinberg added the coq label Mar 1, 2024
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>

<!-- ps-id: f5790361-1f4e-49a4-95aa-47a5a7eb238b -->
@rgrinberg rgrinberg force-pushed the ps/rr/refactor__move_coq_scopes_to_own_module branch from 3980d7d to c04cccb Compare March 1, 2024 14:13
@Alizter Alizter requested review from Alizter and ejgallego March 3, 2024 11:49
{ project : Dune_project.t
; db : Lib.DB.t
; coq_db : Coq_lib.DB.t Memo.Lazy.t
; coq_db : Coq_lib.DB.t Memo.t
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Since this is no longer lazy, wouldn't this mean that we construct the coq_db even if it is not being used?

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.

It's still lazy. This Memo.t is just forcing the cell constructed in Coq_scope.t

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.

The work that is no longer saved is the map lookup in the scope database. However such a map lookup has less overhead than memo's machinery so there's no issue.

@ejgallego
Copy link
Copy Markdown
Collaborator

Lazy handling was indeed pretty subtle on the original code, I'll review the changes ASAP

@ejgallego ejgallego self-assigned this Mar 4, 2024
@rgrinberg
Copy link
Copy Markdown
Member Author

I'm going to merge this as this is getting in the way of making further improvements to Scope. Please review at your own convenience.

@rgrinberg rgrinberg merged commit b0666d3 into main Mar 22, 2024
@rgrinberg rgrinberg deleted the ps/rr/refactor__move_coq_scopes_to_own_module branch March 22, 2024 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants