Thread overview
[Issue 22043] assert_writeln_magic produces confusing examples
[Issue 22043] [std.string] the example of `outdent` in dlang.org is wroung although the original unittest is correct
June 20, 2021
https://issues.dlang.org/show_bug.cgi?id=22043

moonlightsentinel@disroot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|http://dlang.org/phobos/    |
                 CC|                            |moonlightsentinel@disroot.o
                   |                            |rg
          Component|dlang.org                   |tools

--- Comment #1 from moonlightsentinel@disroot.org ---
Changed the component to tools because the asserts are replaced by `assert_writeln_magic.d`.

--
August 01
https://issues.dlang.org/show_bug.cgi?id=22043

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick@geany.org

--- Comment #2 from Nick Treleaven <nick@geany.org> ---
> writeln(pretty); // ugly

lineSplitter is even worse: https://dlang.org/phobos/std_string.html#lineSplitter

> writeln(lineSplitter(s).array); // splitLines(s)

What? Does it mean the two expressions are equivalent??! Then:

foreach (line; lines)
{
    writeln(line); // witness[i++]
}
writeln(i); // witness.length

Transforming those assert statements makes them unintelligible.
It should only do it (if at all) when the right hand side has no side effects
and is not a function call. It's OK when the RHS is a literal.

--
August 01
https://issues.dlang.org/show_bug.cgi?id=22043

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[std.string] the example of |assert_writeln_magic
                   |`outdent` in dlang.org is   |produces confusing examples
                   |wroung although the         |
                   |original unittest is        |
                   |correct                     |

--