5 ms·
This is my personal preference, but from experience I prefer languages that don't shun concepts because they're bad programming practice. I can understand if so
by vortico 9y ago
This is my personal preference, but from experience I prefer languages that don't shun concepts because they're bad programming practice. I can understand if something is difficult to implement or prevents other features from being added, but if a feature is possible, I say add it---it might come in handy sometimes. There's a reason languages like C, C++, Ruby, and Javascript are immensely popular. It's because programmers can use and abuse any nook and cranny of it when needed, because they let you mess with pointers, use goto, redefine language keywords through macros, patch standard libary functions/classes, etc. If programmers want to write bad code, let them write bad code. You can't magically make a bad programmer write good code because of restrictions of the language. I've seen some horribly written Haskell for example, despite how "perfect" the language is designed.
For blocks comments in a functional language though, it might work because many people would come from LISP/Scheme, where block comments were never a thing (I think.)
- phpnode 9y agoSee also GOTO which is a wart 99.9% of the time but really useful for writing e.g. parsers.
- dom0 9y agoError handling.
- johannes1234321 9y agoIn most languages there are better way to do this than goto. Among them - extracting code into smaller functions (yes, state has to passed around) - exceptions (yeah yeah, hate them or love them, but if used in your environment it makes sense not to avoid them) - RAII pattern or handling cleanup, which allows simple return and "automatic" resource handling - etc. True, in a language like C these don't apply necessarily and goto still has some use -
- vortico 9y agoParsers (or more generally state machines) and error handling are the two places I've seen that are acceptable. We've managed to complete the list. :)
- juki 9y ago> LISP/Scheme, where block comments were never a thing (I think.) Lisp does have block comments, #| This is a block comment |# You can also use feature expressions to effectively comment out code #+(or) (defun foo ...) The reader will skip over the following sexp if the feature expression isn't true (and `(or)` never is).
- steveklabnik 9y agoIncidentally, Ruby has block comments, but almost nobody knows about them, because they're inherited from Perl. Ruby comments are line comments with #, but you can also use =begin and =end for block comments.