Don't you wish C was more like this? Or not...

S

SpreadTooThin

if ( ! ( isSeDelimiter() | isItemTag() | isItemDelimiter() ) )
vs
if [ ! { isSeDelimiter() | isItemTag() | isItemDelimiter() } ]

I'm talking about the readability of brackets and nesting them...
 
P

Phlip

SpreadTooThin said:
if ( ! ( isSeDelimiter() | isItemTag() | isItemDelimiter() ) )
vs
if [ ! { isSeDelimiter() | isItemTag() | isItemDelimiter() } ]

I'm talking about the readability of brackets and nesting them...

The latter follows the English grammar rule if you nest () you promote one set
(probably the inner one) to {}, thence [].

No. Each delimiter, in a C language, triggers different behavior. And, at
refactor time, you should not be required to rebalance your delimiters just
because they moved in or out of a longer expression.

And, speaking of refactoring, if you don't like C's grammar you should refactor
your own code to make it readable:

bool whatever = isSeDelimiter() || isItemTag() || isItemDelimiter();
if (whatever) ...

Put another way, your statements should never spread so thin that you find
yourself commenting them, or reinventing their delimiters, when you could be
positively refactoring them to add readability.
 
M

meagar

SpreadTooThin said:
if ( ! ( isSeDelimiter() | isItemTag() | isItemDelimiter() ) )
vs
if [ ! { isSeDelimiter() | isItemTag() | isItemDelimiter() } ]

I'm talking about the readability of brackets and nesting them...

Your editor/IDE should indicate when you have unbalanced or improperly
nested brackets. Your suggestion is just... grotesque. I'm sorry man, but
that's completely awful.
 
N

Nick Keighley

SpreadTooThin said:
           if ( ! ( isSeDelimiter() | isItemTag() | isItemDelimiter() ) )
vs
           if [ ! { isSeDelimiter() | isItemTag() | isItemDelimiter() } ]
I'm talking about the readability of brackets and nesting them...
puke

The latter follows the English grammar rule if you nest () you promote one set
(probably the inner one) to {}, thence [].

No. Each delimiter, in a C language, triggers different behavior. And, at
refactor time, you should not be required to rebalance your delimiters just
because they moved in or out of a longer expression.

And, speaking of refactoring, if you don't like C's grammar you should refactor
your own code to make it readable:

   bool whatever = isSeDelimiter() || isItemTag() || isItemDelimiter();
   if (whatever) ...

I fail to see how this is more readable. It is also wrong!
Whenever you refactor you should re-run all your unit tests.
Do you have unit tests?
Put another way, your statements should never spread so thin that you find
yourself commenting them, or reinventing their delimiters, when you could be
positively refactoring them to add readability.

just rearranging things doesn't improve readability
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top