-
-
Notifications
You must be signed in to change notification settings - Fork 43
Conservative exports + rename parse() #238
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
Conversation
JuliaSyntax.parse() clashes unfortunately with `Base.parse()`. Choose `parsex` for "parse expression" as a replacement. Also add a conservative list of exports that I expect "people are likely to use". There's more to the API than this, but shoving that all into the user's namespace doesn't seem ideal.
Codecov Report
@@ Coverage Diff @@
## main #238 +/- ##
==========================================
- Coverage 96.47% 96.42% -0.05%
==========================================
Files 15 15
Lines 3917 3919 +2
==========================================
Hits 3779 3779
- Misses 138 140 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
|
@timholy I'd value your thoughts on this if you have time. I've been putting off choosing an export list, but it's nice to have some basic functionality included with |
In that sense, |
|
It's true. But I've sometimes found that I'm surprised when a string contains more than one expression and I used Whether |
|
_ |
|
Thinking a bit more about this, there's some terminological weirdness in Julia surrounding "statement" vs "expression"
So it's best to avoid the term "expression" in the naming of these parsing functions as it's extremely ambiguous. That really leaves us with
So I'm thinking the most consistent choices here are
|
Using the name parsestmt() is explicit about the fact that this parses a single statement (not an "expression" which is very ambiguous given every Julia construct is an expression). It's also consistent with the naming rules of `parseall()` and `parseatom()`, which already appear in Base as Meta.parseall and Meta.parseatom. Using rule=:all in the `parse!` API is most consistent with the choices made in the Core._parser interface and the naming `parseall()`.
|
Ok, I made the tweak |
JuliaSyntax.parse()clashes unfortunately withBase.parse(). Chooseparsexfor "parse expression" as a replacement. Actually I think this might be good anyway, because it's really not clear to me whetherparse()should parse a single expression or a whole file top-level. Having a less generic name helps with that I think.Also add a conservative list of exports that I expect "people are likely to use". There's more to the API than this, but shoving that all into the user's namespace doesn't seem ideal.