I’m far from the being an authority on ObjC relative to others on this listserv, but I’ll take a stab at responding. The reason ObjC has its syntax is largely because it was developed around the same time as C++ (slightly after, but close enough) — in other words, it was developed at a time before the C++-style syntax had become a de facto standard. ObjC’s syntax style was largely derived from Smalltalk.
Personally, I like ObjC’s syntax. It was certainly a change from what I was used to, but I actually prefer it in a lot of scenarios. The time when I don’t like it is when you have a line that starts with [[[[ and you have to really work to figure how many opening square brackets you need. And regarding whether you can use C++-style syntax, to use ObjC—that’s kind of a meaningless question. That syntax, for all intents and purposes *is* Objective C. I think what you’re trying to ask is whether you can do Cocoa programming using C++. Someone probably has worked on that at some point, but I suspect it’s not well supported. My suggestion is to try and learn Objective C and you may be surprised to learn that you like it after you get used to it :) Cheers, Daniel Sent from my iPhone > On Nov 5, 2023, at 09:13, loserism <loser...@88.com> wrote: > > > Hi all. > Is there a way for Objective-C to use C++ form of method calls? I.e. use > obj.method(<args>) form of method call instead of [obj method: <args>]? > obj.methodA(<args>).methodB(<args>)... .methodN(<args>) > instead of > [.... [obj methodA: <args>] methodB: <args>] methodC: <args>]...] methodN: > <args>...] > I mean that use the method invocation style instead of the message sending > style. > I'm curious as to why OC must use the message sending style to stand out > instead of the more generic method calling style, I don't believe it's a > technicality! > > By the way sorry, I came here to annoy you all because I couldn't find the > relevant answers on google and GPT, because I know you are the most > knowledgeable group of OC experts, and I hope to get a reply from you. Thank > you all! > > Best Regards!