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

Pretty printing for named closures #121

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

gregorybchris
Copy link
Collaborator

No description provided.

@tekknolagi
Copy link
Owner

nit: can you make the commit title have a verb and active voice

scrapscript.py Outdated Show resolved Hide resolved
scrapscript.py Outdated Show resolved Hide resolved
scrapscript.py Outdated
# If creating a Closure with an Assign we can specify a name for the
# Closure, which may be useful for debugging.
print("Setting closure with name ", exp.name.name)
value = Closure(value.env, value.func, name=exp.name.name)
Copy link
Owner

Choose a reason for hiding this comment

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

If you do

a = x -> x
b = a

what happens?

Copy link
Owner

Choose a reason for hiding this comment

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

An alternative would be catching this in the parser where we see a pattern of Assign(x, Function()) or Assign(x, MatchFunction()) and plumb it through Function too

@tekknolagi
Copy link
Owner

a) maybe switch to the parser approach and
b) can you add reassignment tests for function name/repr?

@tekknolagi
Copy link
Owner

looking good though!

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