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
Suggest _[x..][..n] instead of _[x..x+n] #2272
Comments
Does this have any benefits besides being a cool trick? |
I kinda think the latter is a bit harder to quickly pick up. Less typing,
but it's more confusing.
…-Manish Goregaokar
On Thu, Dec 14, 2017 at 2:42 PM, llogiq ***@***.***> wrote:
This may well be an allowed lint, but I think the latter way is cool and
want more folks to learn about it 🙂
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2272>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABivSHs9PAWuoJfgPfMfErni_piIGl9Sks5tAYhHgaJpZM4RCozn>
.
|
Now that you mention it, yeah, that does make sense. Although the real power of this lint IMO is to notice larger expressions and factor those out too, i.e. Although this is basically a fundamental style difference IMO, and any lint should probably support both directions, unless the API guidelines swing one way or the other. Also, another thing to think about is how much you might want to factor these out. For example, should |
So, there is a 'trivial pattern' change from Also, this is basically the "index syntax" version of Footnotes |
Going from Which is possible when using:
|
The behaviour actually remains the same since internally if they'd overflow a |
This seems like a minor reason to prefer |
Like mentioned earlier in the thread, this idea is mostly driven by aesthetics rather than correctness or performance. For the sake of fully describing (what I think) would make the most sense, I'll distinguish between the two desired formats as the "start-len" format ( Any lint that we define should bail-out if any of the terms used to index are not simple variables or constants, potentially allowing known-pure expressions like We'll define "simplifying" an index as something we need later. This involves a few passes:
To convert something to the start-len format, we just convert We then simplify the indices to determine what to pick, based upon what has the least number of terms. In the event of a tie, or if the user would like to prefer a specific format regardless of complexity. Note: this is not necessarily how the final implementation would look like, it's just my idea for a basic algorithm that would accomplish what I mentioned in my comment. YMMV as always, and there are other cases we might wanna consider. |
This may well be an
allow
ed lint, but I think the latter way is cool and want more folks to learn about it 🙂The text was updated successfully, but these errors were encountered: