Phil Taylor writes: | John Chambers wrote: | >(And we'll still have the even more minor problem caused by | >the fact that some programmers will replace the '\' with a | >space, while others will delete it plus the newline, | >causing the two lines to be joined without a separator. | >This is a problem that still plagues several programming | >languages. It's made worse by the fact that there's no | >logical solution; both ways work equally well. Quandaries | >like this are almost impossible for a group of humans to | >ever solve. ;-) | | Er, why would you want to put a space in place of the backslash? | Joining the two lines without a separator seems the logical | thing to do (or at least I can't immediately think of a situation | where adding a space would make sense).
Well, I tend to agree. But I think the contrary argument is that a lot of people are surprised when the two lines are joined without a space. They then have to go back and fix it (e.g. by putting a space before the '\'). I think the idea is that this "Oops!" reaction wastes more time than the alternative. But note that I called this an "even more minor problem". We're really on the fringe here, and it's probably not worth wasting much time on. I'd also vote for making a final '\' delete both itself and the newline, and join the next line without adding anything. You can always put a space before the '\'. Another fringe case is what happens when a line ends with '\', a space, and a newline. It's common for many implementations to not recognize this as a continuation. This one is really baffling to a user, who usually can't see the space. The right way to handle this is to strip off the trailing spaces (and tabs), and then check for the final '\'. The input routine is now not quite as trivial (though it's still pretty trivial). To subscribe/unsubscribe, point your browser to: http://www.tullochgorm.com/lists.html