Nov. 2nd, 2012

Punctuation

Nov. 2nd, 2012 02:57 pm
jbanana: Badly drawn banana (Default)
For 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:
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.
So I got rid of .(); 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...

May 2025

M T W T F S S
   1234
5678 91011
12131415161718
19202122232425
262728293031 

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 23rd, 2025 02:29 pm
Powered by Dreamwidth Studios