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

Fix Renamer to conform to contract given in docs #332

Closed
wants to merge 1 commit into from

Conversation

marzipankaiser
Copy link
Contributor

Fixes the problem noted in #316 (comment) ,
and should make the output Barendregt unless the generated names (prefix + number / original name + number) are already in use.

@b-studios .

@marzipankaiser
Copy link
Contributor Author

Still missing but in comments: We do not copy annotations in the context.

@b-studios
Copy link
Collaborator

Still missing but in comments: We do not copy annotations in the context.

I think the comment can be deleted, we don't need to :)

// maps symbols bound in the current scope to their renamed variants.
private var bound: Map[Id, Id] = Map.empty
private var bound: List[Map[Id, Id]] = List.empty
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we really need this list of maps?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need is a bit strong. We can get away without, but then we can't have unbind and have to do something like:

val tBinding = rewrite(binding)
withBinding(x) { Let(rewrite(x), tBinding, rewrite(body)) }

for non-recursive bindings.

Which is fine, too, admittedly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, and we could - of course - replace this with a proper Environment type with a lookup.

@b-studios
Copy link
Collaborator

Thanks, cherry picked. :)

@b-studios b-studios closed this Dec 4, 2023
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