Created
July 23, 2012 18:50
-
-
Save focusaurus/3165384 to your computer and use it in GitHub Desktop.
Syntax for comments/docs vs. disabling code blocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
So the question was: should programming languages use a different syntax (or character) for comments intended to be read by developer vs comments whose purpose is to disable code. For example, in my mind, these two scenarios are semantically entirely different intents: | |
# Add 2 px to account for border | |
width += 2 | |
vs ...... | |
#def someFunc(): | |
# pass | |
The interpreter does the same thing in either case: ignore the line. However, I think it would be cleaner if there were 2 different syntaxes. For example: | |
#doc<<EOF | |
Here are some docs about this module. Maybe some parsers will read this and output HTML or whatever. | |
EOF | |
#template<<EOF | |
This is maybe an template using {{templateLang}} and we'll generate {{outputLang}} later | |
EOF | |
These feel very different to me as compared to wanting to hide a block of code from the interpreter/compiler. I guess in Java this is `/*` vs `/**`, which feels like a good distinction, although I don't like how visually similar they are. Ruby has some tricks like this too. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment