Lunderberg commented on PR #11327: URL: https://github.com/apache/tvm/pull/11327#issuecomment-1132076321
> My opinion is that I find the multiple if's far easier to read, as you can discard the context as you go down until you find the eventual output you're looking for Good point. I think the distinction in my mind is whether or not the context should be discarded. In some cases, such as handling a simplified case and early returning, that simplified case no longer needs to be considered. In other cases, such as handling all options for a variable, that context is helpful to recognize it as a single larger construct. > So I don't mind either, but given this project has a diverse audience, I'd rather we pick one style and use it consistently so our code ends up looking similar through-out the codebase. I agree, so long as the consistent style doesn't cause incorrect assumptions for a reader. For me, seeing a series of `N` if-statements says that there are `2^N` possible paths for control flow, and that they should each be considered, where a if/elif chain with `N` blocks says that there are `N` possible paths for control flow. While the `return` statement inside each if-statement prevents there from being `2^N` control flow paths, I'd like to avoid that incorrect first impression. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
