<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Dec 18, 2012, at 11:45 AM, Manuel Klimek <<a href="mailto:klimek@google.com">klimek@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt"><div dir="ltr"><div class="gmail_default" style="">On Tue, Dec 18, 2012 at 8:36 PM, Douglas Gregor <span dir="ltr"><<a href="mailto:dgregor@apple.com" target="_blank">dgregor@apple.com</a>></span> wrote:<br>
</div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div class="h5"><br><div>
<div>On Dec 18, 2012, at 11:31 AM, Manuel Klimek <<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>> wrote:</div><br><blockquote type="cite"><div style="font-family:arial,helvetica,sans-serif;font-size:10pt">
<div dir="ltr"><div>On Tue, Dec 18, 2012 at 7:55 PM, Douglas Gregor <span dir="ltr"><<a href="mailto:dgregor@apple.com" target="_blank">dgregor@apple.com</a>></span> wrote:<br>
</div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">[Re-adding cfe-commits]<div>
<br>
<div><div>On Dec 18, 2012, at 10:16 AM, Daniel Jasper <<a href="mailto:djasper@google.com" target="_blank">djasper@google.com</a>> wrote:</div><br><blockquote type="cite"><div style="font-family:arial,helvetica,sans-serif;font-size:10pt">
<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div>On Tue, Dec 18, 2012 at 6:41 PM, Douglas Gregor <span dir="ltr"><<a href="mailto:dgregor@apple.com" target="_blank">dgregor@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br><div><div>On Dec 18, 2012, at 1:09 AM, Daniel Jasper <<a href="mailto:djasper@google.com" target="_blank">djasper@google.com</a>> wrote:</div>
<br><blockquote type="cite"><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><div dir="ltr"><div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Dec 17, 2012 at 11:04 PM, Douglas Gregor <span dir="ltr"><<a href="mailto:dgregor@apple.com" target="_blank">dgregor@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><div><div>On Dec 17, 2012, at 9:55 AM, Daniel Jasper <<a href="mailto:djasper@google.com" target="_blank">djasper@google.com</a>> wrote:</div>
<br></div><div><blockquote type="cite"><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><div dir="ltr">Hi Fariborz,<div><br></div><div>I am taking a look at your patch, but please bear with me for another day or two. I am not yet convinced that mingling C++ and ObjC formatting that closely is a wise decision. I think we might need something that clearly separates the different modes. And you touch a lot of code that I intended to refactor into something halfway sane this week. I will take your patch into consideration when doing so, but it might need some changes afterwards.</div>
</div></div></blockquote><div><br></div></div>If we're going to distinguish the modes, we need to do so syntactically. Objective-C++ is a very popular dialect; we can't simply rely on extrinsic knowledge of whether we're dealing with Objective-C or C++ to make these decisions.</div>
</div></blockquote><div><br></div><div>I am not sure I fully understand this. We are currently relying on a Lexer which in turn requires LangOptions to create the correct tokens. Same for the identifier table we use to split raw_identifiers into identifiers and keywords. Are you saying the formatter should not capitalize on this knowledge of the input token stream?</div>
</div></div></div></div></blockquote><br></div></div><div>Oh, it should certainly capitalize on this knowledge. My concern is that, when you mentioned that we might need something that "clearly separates the different modes", you were thinking of Objective-C and C++ as independent languages that aren't used together. Fortunately, we can tell syntactically whether we're in an Objective-C method declaration fairly easily: they start with + or -, almost always in the first column, so if it would be better to go down a different code-formatting path where the rules for spacing around (/)/: are different, we could do that instead.</div>
<div><br></div><div><span style="white-space:pre-wrap"> </span>- Doug</div></div></blockquote><div><br></div></div><div>Yeah, "clearly separate" was probably stronger phrased than intended. One of the things I wonder is the following:</div>
<div>If we are not in Objective-C according to the LangOptions and we discover a + or - at the beginning of a "line", should we assume an error has happened (e.g. forgotten "}" or ";") or try to format as an Objective-C declaration?</div>
</div></div></div></div></blockquote><br></div><div>I think we should assume that an error has occurred. If clients don't know the language dialect, they should pick something maximally inclusive (e.g., Objective-C++11). </div>
</div></div></blockquote><div><br></div><div>For files, I assume it's easy enough to detect by the file extension?</div></div></div></div></div></blockquote><br></div></div></div><div>And .h means what, exactly?</div>
</div></blockquote><div><br></div><div style="">I assume with that comment you're telling me it's used for Objective-C, too? :) Reading up the wikipedia page suggests so ... </div><div style=""><br></div><div style="">How different is Objective-C usually layed out? Will we need a configuration to tell us which files in a project are which language, or will we get away with auto-detection? I assume auto-detection is hard as there will be keywords that have special layout rules in both languages?</div></div></div></div></div></blockquote><div><br></div>Objective-C keywords all start with '@'. Common names words with special meanings in objC can be detected in the objective-C syntax. For example, 'copy' in @property (copy) … </div><div>Outside objective-C specific syntax, we stick to what common formatter will give us. For example, I don't see that we want to change layout of ivar declarations any different than</div><div>struct fields (even that can be detected and changed if we want to).</div><div><br></div><div>- Fariborz</div><div><br><blockquote type="cite"><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div style=""><br></div><div style="">Cheers,</div><div style="">/Manuel</div></div></div></div></div>
_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits<br></blockquote></div><br></body></html>