Talk:Strip comments from a string: Difference between revisions

→‎White space: 29 of 36 languages were incorrect?
(→‎White space: Odd? Yep!)
(→‎White space: 29 of 36 languages were incorrect?)
Line 29:
Besides various problems abouve, why the requirement to trim whitespace? In particular, what's the point of trimming the leading whitespace? If whitespaces are significant in the underlying language(fortran, python, etc), trimming them mangles it; if not, then what does trimming achieve at all? --[[User:Ledrug|Ledrug]] 02:35, 10 September 2011 (UTC)
:See the section above on "Wayward space". I too think it odd to trim spaces too, but just took it as a requirement of the task that seemed odd to me, but that's what is called for. --[[User:Paddy3118|Paddy3118]] 06:04, 10 September 2011 (UTC)
 
=== 29 of 36 languages were incorrect? ===
At [http://rosettacode.org/mw/index.php?title=Strip_comments_from_a_string&oldid=119409 2 September 2011], I verified that 8 languages (C, C++, Java, Perl, Python, Ruby, sed, UNIX Shell) were incorrect, all for not trimming whitespace by 29 March 2011 rules. I suspect that 21 more languages (Ada, ALGOL 68, AutoHotKey, Clojure, D, Delphi, F#, Fantom, Fortran, Go, Haskell, Icon and Unicon, Inform 7, Lua, OCaml, PicoLisp, PL/I, PureBasic, REXX, Scheme, TUSCRIPT) might be incorrect for the same reason.
 
Several contributors solved the task before 29 March 2011, when the current rules appeared. I believe that most of the existing solutions became incorrect at 29 March 2011.
 
I propose to delete the 29 March 2011 rules, and add new rules: (1) Code may optionally remove whitespace before the comment marker. (2) Code must not remove any whitespace from the beginning of the line (unless the line begins with whitespace before a comment marker). (3) Code must not remove any whitespace from any line that has no comment. (4) Old examples are exempt from the new rules. --[[User:Kernigh|Kernigh]] 19:46, 10 September 2011 (UTC)
Anonymous user