Skip to content

Allow qstr's with non-ident chars, construct good identifier for them. #215

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

Merged
merged 1 commit into from
Jan 24, 2014

Conversation

pfalcon
Copy link
Contributor

@pfalcon pfalcon commented Jan 23, 2014

Also, add qstr's for string appearing in unix REPL loop, gross effect
being less allocations for each command run.

Just to clarify where this comes from: Mission: make tapping just enter in unix REPL loop to allocate as little memory as possible. Together with #214, this is now down to ~57 bytes per iteration.

@dpgeorge
Copy link
Member

Nice. But, now the qstr _module_ can't be generated. And if I use the qstr, say, MP_QSTR__foo, does this correspond to "_foo" or "<foo" or something else?

How about allowing (for now) only < and > as extra chars, and translate them to _lt_ and _gt_? Such that "<module>" becomes MP_QSTR__lt_module_gt_?

@pfalcon
Copy link
Contributor Author

pfalcon commented Jan 23, 2014

Yep, it's a bit quick&dirty, logic behind: Python doesn't use idents of form _foo_ (single underscores), and probability of needing both <foo> & (foo) is so low that we can defer until it happens. I also thought of using html entity like approach. Do you think we should do that right away?

@dpgeorge
Copy link
Member

Yes, I think do it properly now. Otherwise someone (probably me!) will get confused with MP_QSTR__module_, wondering what the actual string is that it resolves to.

Also, add qstr's for string appearing in unix REPL loop, gross effect
being less allocations for each command run.
@pfalcon
Copy link
Contributor Author

pfalcon commented Jan 24, 2014

Easy one-liner!

dpgeorge added a commit that referenced this pull request Jan 24, 2014
Allow qstr's with non-ident chars, construct good identifier for them.
@dpgeorge dpgeorge merged commit 60aca48 into micropython:master Jan 24, 2014
@pfalcon pfalcon deleted the qstr-special-chars branch June 6, 2014 19:04
tannewt added a commit to tannewt/circuitpython that referenced this pull request Feb 21, 2018
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