Skip to content

Add walrus operator to lexer and try to make lexer code cleaner. #968

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 4 commits into from
Jun 11, 2019

Conversation

windelbouwman
Copy link
Contributor

No description provided.

@codecov-io
Copy link

codecov-io commented May 12, 2019

Codecov Report

Merging #968 into master will decrease coverage by 0.03%.
The diff coverage is 87.36%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #968      +/-   ##
==========================================
- Coverage    64.7%   64.67%   -0.04%     
==========================================
  Files          97       97              
  Lines       17041    17032       -9     
  Branches     3799     3802       +3     
==========================================
- Hits        11026    11015      -11     
- Misses       3441     3442       +1     
- Partials     2574     2575       +1
Impacted Files Coverage Δ
parser/src/token.rs 42.85% <ø> (ø) ⬆️
parser/src/lexer.rs 79.82% <87.36%> (-0.42%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1b968e9...aa6b155. Read the comment docs.

@cthulahoops
Copy link
Collaborator

The walrus operator is 3.8 only? Are we targetting that? I tend to feel like we should target 3.7 rather chasing the latest shiny version. (I may be biased because the walrus operator feels like a mistake for the language.)

The lexer refactor is great. It would be nice to split the refactor and feature into separate commits.

@coolreader18
Copy link
Member

Should we merge this now? @cthulahoops would you be good with that? It's been 20 days since this was opened and we should merge before there are conflicts.

@windelbouwman
Copy link
Contributor Author

I will remove the walrus operator from this change to split the refactor and the walrus operator, so I would rather wait for this.

@windelbouwman
Copy link
Contributor Author

@cthulahoops could you re-review?

@Mr-Andersen
Copy link

Excuse me, I don't understand, why Python actually needs "walrus operator". Why don't they implement assignment as binary operator?

@cthulahoops
Copy link
Collaborator

cthulahoops commented Jun 11, 2019

Excuse me, I don't understand, why Python actually needs "walrus operator". Why don't they implement assignment as binary operator?

To avoid the confusion between == and = which is a common error in other languages. ie.

if x = 5:
   ...

I always thought the lack of an assignment operator was a strength of python. The walrus operator seems like an odd thing to introduce. It'll save a couple of lines of code in its few legitimate uses, but it'll get lots of use where it sholudn't.

Copy link
Collaborator

@cthulahoops cthulahoops left a comment

Choose a reason for hiding this comment

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

Looks good!

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.

5 participants