Bug 8379 – std.algorithm.findSplit example is freaking hard to read

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-07-11T23:03:00Z
Last change time
2012-08-30T14:22:37Z
Assigned to
nobody
Creator
ellery-newcomer

Comments

Comment #0 by ellery-newcomer — 2012-07-11T23:03:35Z
See, the function has a pretty descriptive name, and after reading the docs on the function, it's clear the function probably does what I think it does, so now I only need a quick confirmation with an example like that one right down there and what the hell?? why is it returning that part of the array? *squint* oh. that's a slice. what part of the array is it? probably the part I think it is. glad I have so many fingers. hey, look! slice indeces and values at indeces don't match up! so are a[6 .. $] and [7,8] the same thing? maybe. probably. sure wouldn't want start programming under a slightly wrong assumption though. anyways, my point is the array literal is tiny and slicing into it in the asserts is unnecessary and inhibits readability. Also, string literals are more readable than integer literals.
Comment #1 by ellery-newcomer — 2012-08-30T14:22:37Z
Well, this is embarrassing. s/6484/8379/ on the following: Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/aa40b3b47d64dbf55bd559f113148925ced61ccf Merge pull request #753 from mylodon/enh6484 fix issue 6484