commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Caswell <steven.casw...@gmail.com>
Subject [lang] Revisiting empty statements one more time (last time I promise)
Date Mon, 04 Jul 2005 16:16:35 GMT
Gary and Stephen (and anyone else who might care ;)

I'd like to take one more stab at convincing you guys that an empty
statement denoted by a semicolon would be a better approach to
indicate no action than just using a comment. I promise I'll move on
if this is not convincing enough.

So here we go:
- Empty statement is defined by the language so while it may look odd
it is in fact a valid Java statement
- Since it is a legal Java statement, it is parsable and shows up in
ASTs. Comments are discarded and do not show up in ASTs
- Any tool that uses an AST approach to examining source constructs
(such as PMD) can be told to look for and handle an empty statement.
Tools that use ASTs cannot be told to look for comments.

IMHO, having the statement parsable and recognizable by tools gives
the most flexibility at a pretty small price. The empty statement
doesn't affect logic at all, and doesn't affect performance in the
tests I've done. It seems a small price to pay (a bit of adjustment in
reading the code) for the benefit.

If a line with a single semicolon is not acceptable, is there some
other parsable construct that would be?

Thanks for the indulgence.

-- 
Steven Caswell
steven.caswell@gmail.com

Take back the web - http://www.mozilla.org

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message