You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
x[a..b] // half-closed
x[a...b-1] // open
for i in 0..N {} // half-closed
for i in 0...N-1 {} // open
switch x {
case a..b: // half-closed
case x...y: // open
}
Proposed:
x[a:b] // half-closed
for i in 0..N-1{} // open
switch x {
case x..y: // open
}
Rationale: removes confusion between .. and ... and adds familiarity for slicing from languages such as Python and Go.
The text was updated successfully, but these errors were encountered:
This strikes me as a good idea, despite having two very different operators
for similar things.
The familiarity from slicing languages is a decent idea; the difference
will be easier to remember and work with because of the Python/Go reference
- at least for polyglots.
If you're a C-only programmer, then it won't be so obvious, but still.
In my experience, the open range is normally what you want, and is clearer
because of the explicit N-1, so I'd personally prefer that to be `..`.
With this change, both operators are short to type... Three dots always
felt a bit much to me.
On Wed, 1 Aug 2018, 15:07 gingerBill, ***@***.***> wrote:
Current:
x[a..b] // half-closed
x[a...b-1] // open
for i in 0..N {} // half-closed
for i in 0...N-1 {} // open
switch x {
case a..b: // half-closed
case x...y: // open
}
Proposed:
x[a:b] // half-closed
for i in 0..N-1{} // open
switch x {
case x..y: // open
}
Rationale: removes confusion between .. and ... and adds familiarity for
slicing from languages such as Python and Go.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#239>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABST0Fe2fhKv7BhmhZXxKECa24oqxTk6ks5uMbY7gaJpZM4VqkZY>
.
Current:
Proposed:
Rationale: removes confusion between
..
and...
and adds familiarity for slicing from languages such as Python and Go.The text was updated successfully, but these errors were encountered: