[Issue 8379] New: std.algorithm.findSplit example is freaking hard to read

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 11 23:03:37 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8379

           Summary: std.algorithm.findSplit example is freaking hard to
                    read
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: ellery-newcomer at utulsa.edu


--- Comment #0 from Ellery Newcomer <ellery-newcomer at utulsa.edu> 2012-07-11 23:03:35 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list