Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Objective C keywords to C++ keyword list #246

Closed
wants to merge 1 commit into from

Conversation

cconroy
Copy link
Contributor

@cconroy cconroy commented Mar 16, 2015

Many Objective C users rely on the C++ generated code to use protobufs in objective C.

See https://www.safaribooksonline.com/library/view/learning-objective-c-20/9780133047462/app01.html for a listing of keywords.

// OBJECTIVE C KEYWORDS AND MACROS
"__autoreleasing", "__strong", "__unsafe_unretained", "__weak", "id", "Class",
"_cmd", "BOOL", "BSD", "bycopy", "byref", "IMP", "In", "inout", "Nil", "nil",
"NO", "oneway", "out", "SEL", "self", "super", "YES"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will likely to break existing clients, especially those all caps ones. I did a quick code search internally all the caps one are already being used as enum values: BOOL, BSD, YES, NO and SEL.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also checked lower-cased words: id, out, self, nil, oneway, super are also used as field names, which will break clients if we put them here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we put this behind a command line flag? --objc-compatible or some such?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit concerned that we will end up adding more and more keywords for other languages. There will be an official objective-c support release in a month or two. I think the need for linking in C++ messages should be significantly reduced.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, in that case we can probably just wait for the official support. If the obj c compiler doesn't already have a keyword list, you might want to use this. I don't see objective C in the source tree?

@cconroy cconroy closed this Mar 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants