Closed timotheecour closed 3 years ago
Another argument in favor of deprecating: As far as I know only b[.. 2]
but not b[2 ..]
is a thing. This asymmetry feels a bit awkward, because in other languages slice boundaries are typically either mandatory or optional in both positions.
Well but Nim simply doesn't have postfix operators, at all. Which is OK.
It only feels "awkwardly" asymmetric when you look at it from an ignorant angle though. Nim simply doesn't have postfix operators so why would 2 .. be a thing? Perfectly senseful design.
No need to insult anyone. It is still a matter of expectation coming from other languages, no matter how sensible it is.
Sorry, no insult implied. I suppose "ignorant angle" isn't as neutral as I hoped it to be.
Nuke it. :+1:
Again, "Accepted RFC" here means, "let's see what it breaks".
I might be using this, I don't really like it but why remove it and whats the alternative? Edit: Could it be fixed instead?
Fine. 0..x is easy to write as well. Actually it seems, I have already removed it from my project.
proposal
deprecate unary slice https://nim-lang.github.io/Nim/system.html#..%2CsinkT
rationale
example 1
it seems error prone eg:
prints: true false
it'd be useful if
b[.. 2]
would be syntax sugar forb[b.low .. 2]
(analog tob[3..^1
) but it seems that all it does is being equal todefault(int)
, ie0
.I don't see the point of avoiding to type
0
.example 2
it also doesn't compose well with rest of nim, eg:
(analog to https://github.com/nim-lang/Nim/issues/6215)