ObjC and underscores

13 views
Skip to first unread message

Avi Drissman

unread,
Dec 3, 2019, 10:57:15 AM12/3/19
to Chromium Embedders
In the late 2000s, when Chromium was started, ivars in ObjC code typically had no underscore decoration at all, so the Chromium team adopted Google C++ style and used trailing underscores.

Later on, Apple decided on a leading underscore convention, and started coding it into the platform. Synthesized ivars, KVC accessors, and the like all assume leading underscores, and the style has taken off.

The Chrome Mac team has decided to stop swimming against the current and change our current usage; a bug is filed. I wanted to give a heads-up to the embedder community. This shouldn't affect your code's use of the existing classes, as the ivars should all be private. However, this will be some churn, and it might cause some rebasing issues.

Sorry for the inconvenience; this will get us to a place where the average Cocoa developer feels more at home.

Avi
Reply all
Reply to author
Forward
0 new messages