Punctuation
Nov. 2nd, 2012 02:57 pmFor ages I've been putting extra white space in code. It's not required, but it looks better to me. For example, most people (and code auto-formatters) would do something like this:
To make the names stand out from all the punctuation marks, I'd say:
It occurred to me today that context makes most of the punctuation unnecessary:
A possible down side is ambiguous cases. The punctuation might let me distinguish things with the same name, but a better solution there is to pick better names.
I wonder how hard it would be to write a pre-processor to turn words-only code into regular code? While we're at it, let's get rid of block markers (curly brackets,
Now if only I had a bottomless pit of time available...
Or if I can find someone who's already done this...
things.put(name,value);
To make the names stand out from all the punctuation marks, I'd say:
things.put ( name, value );
It occurred to me today that context makes most of the punctuation unnecessary:
things put name, value
- We know what the first word means because it's a name refers to something.
- The second word is easy because a put method exists on things.
- The next thing must be parameters,and I think that the comma has to be there so that the params are marked as a list, but I'd be happy to be proved wrong.
- The end of the line is the end of the statement.
.();
which were helping the computer but not me. All that's left is descriptive words, meaningful to humans.A possible down side is ambiguous cases. The punctuation might let me distinguish things with the same name, but a better solution there is to pick better names.
I wonder how hard it would be to write a pre-processor to turn words-only code into regular code? While we're at it, let's get rid of block markers (curly brackets,
begin
, etc.) and use indentation, Python style. Seems like something that could work in any number of languages.Now if only I had a bottomless pit of time available...
Or if I can find someone who's already done this...