Bringing Objective-C to the Amiga (2018)
blog.nil.im
blog.nil.im
Of course that lead to a bit of a mixed result. For one, most of the new features were syntactically isolated to the Obj-C square brackets. On the other hand, within those brackets things were considerably un-C-like. object.method(arg) seems more "native" than [object method:arg].
I actually liked this grafted-on appearance. It was a clear signal that said: Yeah, we're still C, let's not make any illusions about this. By comparison C++ had more delusions of grandeur, almost from the start.
This is also why I'm not that fond of almost any changes to Objective-C that were made later, especially by Apple. That includes the various searches for better memory management, but also the property dot syntax.
I'm still a bit sad that the Objective-Javascript thing never took off. Way better than most of the added language features since then.
Seriously, I could never understand this claim of "elegance" of Objective C…
It'd be news if this changed. But every other desktop sadly sucks.
Now that Swift has supplanted ObjC on Mac and iOS, it feels somehow comforting to know that my ObjC love can live on in the arms of my Amiga love.
Apparently, MorphOS already has out of box ObjC developer support for MUI, via ObjFW. But that requires using MorphOS and MUI, which not everyone necessarily wants to do that.
Sounds like he didn't use the -fexception flag?
"-funwind-tables" enables stack unwinding
"-fasynchronous-unwind-tables" makes the stack unwinding available for debuggers
"-fno-dwarf2-cfi-asm" makes the debugger unwind table "old style", so unwinding info goes into .eh_frame and .eh_frame_hdr section (or .ARM.extab and .ARM.exidx on ARM) instead of .debug.*
These sections are then parsed by the backtrace() family of glibc calls: https://www.gnu.org/software/libc/manual/html_node/Backtrace...
https://news.ycombinator.com/item?id=16899658
Is it OK to repost my comment as well?
https://news.ycombinator.com/item?id=16900938
" Funky!
I "brought" Objective-C to the Amiga sometime in ~1986/1987.
I had recently acquired one of the first Amigas in Germany, still a US NTSC model, and also seen Objective-C discussed in a BYTE article. The beautiful OO structure of the Amiga Exec kernel and the higher OS levels built on top of those abstractions (except the abomination that was AmigaDOS) was almost certainly an inspiration.
Having also recently purchased my first C compiler, Manx Aztec C, I initially had some fun with implementing OOP via some Macros and the Amiga shared library mechanism, which was essentially an array of function pointers/C++ vtable.
I don't quite remember when I got the crazy idea of actually implementing an Objective-C runtime and preprocessor, before or after getting the book. I do remember that it felt very much "here goes nothing", and it really was nothing. I was in high school, I had no CS training, didn't know about compilers, hadn't programmed in C for more than a couple of months.
So I wrote a weird lexer that used a bitmap and two counts to cover all the regex cases, a syntactic recognizer that could tell the Objective-C constructs apart most of the time (it had a hard time distinguishing a method send with a cast from indexing into the return of a function call). And a runtime and basic object library. My dictionary implementation turned out to be ordered almost by accident, I have grown very fond of ordered sets and dicts. It also had automatic serialization ("passivation" as it's called in the book), something Apple has only gotten around to just now, and only for Swift.
It worked and I never looked back. I later ported it to i386 and QNX + MS-DOS for a project, replacing the assembly-language messenger function with a pure ANSI-C one returning the function pointer of the method (a technique later rediscovered for the GNU runtime).
When NeXT came out I knew I had to have one. And ditched my implementation in a heartbeat: SEP!
Interestingly, there was another Objective-C implementation from Germany in around the same timeframe called M:OOP, which actually got a little bit of press coverage:
https://ekartco.com/wp-content/uploads/2012/11/m_oop.pdf
As far as I could tell, it never got the fully generic objc_msgSend() running, with only a limited number of arguments supported.
Fun times, but also valuable lessons:
- Go tackle "crazy ambitious" projects.
- A language that can be implemented by a kid with a C compiler is a gem.
- An architectural approach to language is really valuable.
"
These days, I would probably work harder to make it possible for Objective-C to generate and work with Amiga shared libraries.