-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Forward port CommandLineParser rewrite #7676
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
Forward port CommandLineParser rewrite #7676
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, and thank you for opening this PR! 🎉
All contributors have signed the CLA, thank you! ❤️
Have an awesome day! ☀️
Can you add a link to the corresponding scala/scala PR or commit in the commit message ? |
Could you add the links to the commit message (not only the PR description). It is to make sure it is in the git history. |
Yes, I'll update. I just looked at this again, wondering whether to improve the quick'n'dirty code. |
67b36f8
to
3963aa0
Compare
Added test and dependency on scala-testkit. |
Probably spurious?
|
3963aa0
to
cd642d0
Compare
I guess not spurious.
|
cd642d0
to
0d69058
Compare
Removed testkit dependency, converted syntax, rebased. |
Improvements on scala 2 were motivated by exponential parsing costs: scala/scala#6622 scala/scala#5882
0d69058
to
bac75e5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM!
var start = 0 | ||
val qpos = new ArrayBuffer[Int](16) // positions of paired quotes | ||
|
||
inline def cur = if done then EOF else line.charAt(pos): Int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is that type ascription needed? Could it be moved to be the result type of cur instead?
inline def cur = if done then EOF else line.charAt(pos): Int | |
inline def cur: Int = if done then EOF else line.charAt(pos) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
charAt
is a char. The benefits of this style choice are to point out the problematic expression; it looks more cool; in result type position, it's like having eyeglasses wrapped in tape where they broke. That's why implicits, the nerdiest feature, requires it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I guess that's fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit quirky, and it was so long ago, I had to reconstruct my thinking. On the up side, with all the talk about command line parsing support for main entry point, probably this code will be replaced anyway. It was mostly aimed at Process building.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also thanks, this was to get my feet wet with the repo and process, low benefit and low risk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks to you for porting this! And sorry for the long delay before the review, it slipped my mind.
Tests to follow. (When I learn how to add tests.)
Bookmarking:
scala/scala#6622
scala/scala#5882