Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Conversation

@exalted
Copy link

@exalted exalted commented Feb 12, 2013

@joshaber
Copy link
Contributor

/cc @github/mac.

I'm 👎 since it adds unnecessary syntactic noise.

@exalted
Copy link
Author

exalted commented Feb 12, 2013

@joshaber what would you suggest instead?

@dannygreg
Copy link

👍 I don't see it as noise at all.

My brain finds it way easier to scan when they are grouped together by parens.

@jspahrsummers
Copy link
Contributor

👎 This doesn't match any of our other binary operators. I also think that readability/scanability is much easier accomplished with whitespace than parentheses, generally:

[obj someMethod:1 + 2]; int value = otherValue & 0x2; BOOL weGood = thatCondition && anotherCondition; [jackson rockMyWorldWithOptions:MJAwesomenessMoonwalk | MJAwesomenessReverse];
@dannygreg
Copy link

I feel pretty strongly that:

[jackson rockMyWorldWithOptions:(MJAwesomenessMoonwalk | MJAwesomenessReverse)];

Is more scannable… although it becomes hard to quantify and therefore debate it in any constructive manor :/

@jspahrsummers
Copy link
Contributor

I think consistency in our style is pretty important unless we have a good reason to break it. If we wouldn't do the same for other binary operators (like +), why treat this one differently?

@exalted
Copy link
Author

exalted commented Feb 12, 2013

@jspahrsummers fair point, in fact I would go further and say...

[obj someMethod:1 + 2];

… should be [obj someMethod:(1 + 2)]; instead.

About following though I think likewise: wrapping parentheses increase readability if not making it worse...

int value = otherValue & 0x2;
BOOL weGood = thatCondition && anotherCondition;

What do you feel about about...

// if inline [obj someMethod:(1 + 2)]; [jackson rockMyWorldWithOptions:(MJAwesomenessMoonwalk | MJAwesomenessReverse)]; [pullRequest merge:(dannygreg && jspahrsummers && joshaber)]; // otherwise int sum = 1 + 2; [obj someMethod:sum]; MJAwesomeness options = MJAwesomenessMoonwalk | MJAwesomenessReverse; [jackson rockMyWorldWithOptions:options]; BOOL shipIt = dannygreg && jspahrsummers && joshaber; [pullRequest merge:shipIt];

…?

@jspahrsummers
Copy link
Contributor

Sorry, I just find that hideous. The parentheses don't add anything to me – it's like we're combining C function calls and Objective-C message sends and keeping all the syntax from both.

@exalted
Copy link
Author

exalted commented Feb 12, 2013

Okay, I am out of better ideas for the moment 🙏

@exalted
Copy link
Author

exalted commented May 14, 2013

Let's close this, if it ain't gonna make it. Shall we? 💃

@joshvera joshvera closed this May 15, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

5 participants