4 ms·
Question: is Objective-C post 2.0 being actively maintained outside of Apple? Can I use the new features that Apple added in cross platform projects or open so
by sharikous 3y ago
Question: is Objective-C post 2.0 being actively maintained outside of Apple?
Can I use the new features that Apple added in cross platform projects or open source environment like this?
I loved Objective-C very much (yes, really) and I'd like to continue using it after Apple phases it out
- em-bee 3y agowell, the one positive thing about apple phasing out Objective-C is that enthusiasts may be more motivated to work on GNU Objective-C to catch up, also considering that doing so is no longer a runaway target.
- jhatemyjob 3y agoThe clang/LLVM Objective-C compiler is open source. You can use the same bleeding edge compiler for iOS 17 on Linux for example. So you can use features like Automatic Reference Counting, blocks, etc no problem. The problem is the frameworks (Foundation, UIKit, AppKit, etc) are closed source. So you either need to create your own frameworks or use something like GNUstep.
- chasil 3y agoPrevious posts describe Swift in a state of flux, while Objective-C is more stable in most areas. It would not appear that phasing out Objective-C would even be possible. https://news.ycombinator.com/item?id=35914330 https://news.ycombinator.com/item?id=35914330
- MBCook 3y agoApple has the largest Objective-C code based in the world (I would assume). It’s going to take them a long time to covert it. So I don’t see them dropping it anytime soon. It’s not recommend for new code (in Apple land) and they’re already starting to make features Swift-only. But they won’t stop shipping it any time soon.
- wahern 3y ago> It’s not recommend for new code (in Apple land) and they’re already starting to make features Swift-only. That's a real shame because FFI language bindings to Objective-C frameworks are amazingly simple to do with Objective-C. You basically create low-level C ABI bindings to objc_msgSend and about 40 other routines (e.g. class_getName). The latter bindings are principally for introspecting the class hierarchy and acquiring references to opaque class and method implementation pointers. method_getTypeEncoding returns a text-encoded type signature for a method. And objc_msgSend itself is a magical variable argument function for invoking arbitrary methods on arbitrary objects (including classes, which are objects themselves). With that small set of C ABI bindings you can generate strongly typed bindings to all the many thousands of Objective-C framework and library interfaces, system and third-party. I did this for Lua and it works beautifully. And you can just as easily define new classes and methods and wire them up to the host language (Lua, Python, Java, Rust, etc), though I haven't needed to do that just yet. In my case this is all done dynamically at runtime, except for the ~40 required static C function bindings. The only difficult part was binding objc_msgSend. You could use libffi, but in my case I wrote a script to statically generate a permutation of Lua/C binding functions with up to 6 arguments, any 2 of which could be doubles instead of scalars, and either a scalar or double return value. Atop those bindings sits a small Lua library which, using the other ~40 Lua/C function bindings, implements a type-safe bridge for the entire macOS Objective-C platform, GUI frameworks and all, modulo a small number of niche edge cases (e.g. IIRC there's a special Objective-C ABI for directly returning small structures which my objc_msgSend bindings don't implement, but I haven't run into those cases and my Lua bridge code would throw an error if I tried). Because Objective-C itself uses reference counting, it plays well with any GC environment or lack thereof. I'm sure Swift is a nice language, but there are many nice languages, and Objective-C makes language interoperability downright dreamy.
- hgs3 3y ago> Question: is Objective-C post 2.0 being actively maintained outside of Apple? Yes as part of the GNUStep project [1]. You can compile Objective-C with Clang for any platform, including Windows, and link with the GNUStep Obj-C runtime. The big problem is outside of GNUStep and macOS you won't have any frameworks - not even NSString. > I loved Objective-C very much (yes, really) and I'd like to continue using it after Apple phases it out You're not alone. Unlike C++, Obj-C was a reasonable OO extension to C. It's a shame the language never received more love. [1] https://github.com/gnustep/libobjc2 https://github.com/gnustep/libobjc2
- apple4ever 3y agoYou could also use something like ObjFW to get some of those nice classes.