←back to thread

107 points wmlive | 3 comments | | HN request time: 0.763s | source
Show context
itslennysfault ◴[] No.42129253[source]
So, this is why the abomination that is Obj-C is/was used for iPhone/Mac apps. I can't overstate how much I hate Obj-C. I'm so sooo happy Swift has pretty much entirely taken over.

Side note... I feel similarly about the Java to Kotlin transition. Sooo much better. Although, I don't hate Java NEARLY as much as Obj-C.

replies(5): >>42129327 #>>42129817 #>>42130011 #>>42130250 #>>42130804 #
ramesh31 ◴[] No.42129327[source]
To each their own. I'm convinced it's just a visceral reaction to the square bracket syntax. Obj-C remains my favorite language of all time (although I haven't written it in years). Having a high level language that allows you to seamlessly drop into C felt like magic.
replies(5): >>42129520 #>>42129543 #>>42129839 #>>42130389 #>>42130417 #
nullpoint420 ◴[] No.42129543[source]
I'm using Obj-C for the first time in years for a side project. I'm working on making a Wayland backend for cocotron on Linux.

It is magical the way I can just use the C libraries with all the dynamic goodness Obj-C.

replies(1): >>42130331 #
1. Longhanks ◴[] No.42130331[source]
There's even more magic: You can even use/include/write/mix and match ObjC with C++, within the same source file - C++ classes calling ObjC methods, ObjC methods instantiating C++ classes, it's all there. No other language comes close to this kind of interop with C++ and it is one feature that Swift will never be able to match (albeit intentionally).
replies(1): >>42130612 #
2. tambourine_man ◴[] No.42130612[source]
https://www.swift.org/documentation/cxx-interop/
replies(1): >>42130785 #
3. Longhanks ◴[] No.42130785[source]
Yes, there is interop at the linking level. I was however explicitly stating that you can mix and match both ObjC and C++ within the same source files and as long as you don't violate the language rules of one with what's allowed in the other (e.g. giving your ObjC variable the name template), then absolutely any features, even language-wise, are supported. You can have C++ RAII destructors call ObjC methods. You can have C++ classes with an NSArray member. You can have a std::vector as a property of your ObjC class. You can mix and match libdispatch, std::call_once, ObjC blocks and C++ lambdas.

No other language comes close to this incredible source-level interop. Here be dragons, but there's also lots of opportunity (and fun, from a programming languace theory perspective).