News for hackers. Stuff that matters.
Re:The origins of Objective-C at PPI/Stepstone and its evolu... by gdubs on Sunday June 14, 2020 @09:43AM (#23517587)
This is a wonderful bit of history, really grateful to have it. I remember reading an interview with Steve Jobs in Wired magazine in the 90s where he talked about the future being all about Objects – "The Next Insanely Great Thing" [1]. I built my career on top of Objective-C. These days I really enjoy Swift, but I still have a space in my heart for the dynamic beauty of Objective-C.

1: https://www.wired.com/1996/02/jobs-2/

Re:The origins of Objective-C at PPI/Stepstone and its evolu... by pixelrevision on Sunday June 14, 2020 @10:26AM (#23517834)
Swift is great but is starting to suffer from feature bloat. I really loved the simplicity of objective-c. If you can get past the syntax you find a very thin wrapper on top of c that lets you do really fun things. I don’t think I’ve ever seen another language where people followed the same patterns so consistently either.
Re:The origins of Objective-C at PPI/Stepstone and its evolu... by justinmeiners on Sunday June 14, 2020 @12:13PM (#23518857)
> where people followed the same patterns so consistently

so true. This is one ecosystem where you could actually just include another persons code as if it was yours, and get a great understanding of how to use it from a header.

Re:The origins of Objective-C at PPI/Stepstone and its evolu... by carlosrg on Sunday June 14, 2020 @03:15PM (#23520474)
All modern languages tend to suffer from feature bloat - there's this obsession of covering every single edge use case, every possible paradigm. C#, Swift, Rust, Python, even C++, all are in this competition dynamic where they want to natively support everything the others do. It's very tiring to keep up, and it's a quick way to end up with a buggy unmaintainable mess of a language.
Re:The origins of Objective-C at PPI/Stepstone and its evolu... by jrochkind1 on Sunday June 14, 2020 @09:48AM (#23517614)
Ruby is probably one of the current languages most like ObjC in it's bones, at least in certain dimensions, due to them both being so influenced by smalltalk. But ruby isn't necessarily doing great as far as market share either. :(
Re:The origins of Objective-C at PPI/Stepstone and its evolu... by gdubs on Sunday June 14, 2020 @09:57AM (#23517659)
It's been a while since I've used it, but before I made native apps I had a little web development business going, and used Ruby on Rails extensively. I couldn't articulate the similarities at the time with ObjC, but looking back I'm sure it had a lot to do with my comfort working in Ruby. And, I credit that web work I did in Ruby with my becoming a better programmer.

Being able to drop in to low-level C for real-time applications (audio, in my case) was a great aspect of ObjC. Though there were plenty of times I wished I could program in ObjC in the real-time threads. There were many debates on the Core Audio forums about whether ObjC was safe in real-time threads. Most of Core Audio was developed by C++ programmers, and their default was to avoid ObjC out of a fear that a surprise lock or memory allocation would glitch out the audio. There was, however, at least one NeXT veteran on the forums who felt this was nonsense, and recalled writing device drivers in ObjC.

Re:The origins of Objective-C at PPI/Stepstone and its evolu... by mpweiher on Sunday June 14, 2020 @10:48AM (#23518020)
> one NeXT veteran on the forums who felt this was nonsense, and recalled writing device drivers in ObjC

So did I.

https://www.nextop.de/NeXTstep_3.3_Developer_Documentation/O...

It was quite lovely, and I later heard from Apple kernel devs that moving to C++ from Objective-C was one of their biggest regrets.

Re:The origins of Objective-C at PPI/Stepstone and its evolu... by pjmlp on Monday June 15, 2020 @01:26AM (#23524077)
Apparently they did not regret enough, because DriverKit was the opportunity to reboot that decision, and it was decided to still be C++ only.
Re:The origins of Objective-C at PPI/Stepstone and its evolu... by PaulDavisThe1st on Sunday June 14, 2020 @01:55PM (#23519714)
It isn't a "fear" - it's avoidance of demonstrated behavior.

You cannot use any GC-based language if you want to guarantee an upper bound on latency. You cannot use any language that uses global or even large-scope locks if you want to guarantee an upper bound on latency.

It has nothing to do with "writing device drivers" - there are plenty of device drivers for which latency is not anything like the issue that it is for audio.

Re:The origins of Objective-C at PPI/Stepstone and its evolu... by 1over137 on Sunday June 14, 2020 @02:24PM (#23519965)
>You cannot use any GC-based language if you want to guarantee an upper bound on latency

ObjC wasn't then and isn't now an GC-based language.

Re:The origins of Objective-C at PPI/Stepstone and its evolu... by cmrdporcupine on Sunday June 14, 2020 @04:37PM (#23521118)
Someone else has made this point below, but I'm not sure where this misunderstanding comes from. Reference counting is a form of garbage collection.

My copy of Jones and Lins "Garbage Collection" textbook includes Reference Counting as its first item its "classical algorithms" chapter.

It's usually non-tracing, but variants that can cycle collect will even do some limited tracing to resolve cycles.

And the original comment about latency still stands, even for RC. A single de-reference can lead to a whole series of collections, taking an unknown amount of time, and thrashing cache in the process. A deep tree of objects deleted at the top creates a cascade of de-references. And modern high level languages tend to encourage deep object trees.

When doing realtime programming, I avoid anything with GC. Out of experience. Yes it is possible to tune GC for realtime performance -- but it's fiddly, and never perfect. There are systems tuned for incremental realtime collection -- but there is a cost to this.

As software engineers our job is to pick the right tool for the job. I had many years usually almost exclusively garbage collected languages (including Objective C) before ending up where I am now (I work mainly in C++ lower down the stack)

Manual memory management still exists for a reason.

Re:The origins of Objective-C at PPI/Stepstone and its evolu... by jolux on Monday June 15, 2020 @09:05PM (#23534902)
I'm sure I sound like a broken record but Rust has solved the problem of memory safety lower in the stack pretty well with the borrow checker. There is almost no reason to use unsafe code aside from interop.
Re:The origins of Objective-C at PPI/Stepstone and its evolu... by cmrdporcupine on Monday June 15, 2020 @10:29PM (#23535393)
Sure, I'd be into it, if someone would pay me to work in Rust. That hasn't happened for me yet.

But there is a cognitive overhead cost to working with Rust. Or even just following consistent RAII patterns in C++. It doesn't come for free.

Trade-offs.

Re:The origins of Objective-C at PPI/Stepstone and its evolu... by jolux on Tuesday June 16, 2020 @06:26PM (#23545065)
Yep. ‘Tis true. I keep telling Rust people that I could do with less syntactic overhead and that sometimes I just want GC, but I don’t think it’s a priority for the community and they already have a lot on their plate and it does basically everything else right, imo.
Re:The origins of Objective-C at PPI/Stepstone and its evolu... by jolux on Sunday June 14, 2020 @03:07PM (#23520389)
Ignoring the problem with calling something a “GC-based” language, Objective-C is most typically used with ARC these days, which is definitely GC.
Re:The origins of Objective-C at PPI/Stepstone and its evolu... by snuxoll on Sunday June 14, 2020 @03:35PM (#23520630)
Reference counting is still not garbage collection. ARC causes the compiler to implicitly insert calls to retain and release, that’s it. Everything is still 100% deterministic at runtime.
Re:The origins of Objective-C at PPI/Stepstone and its evolu... by pcwalton on Sunday June 14, 2020 @07:50PM (#23522480)
Reference counting is a form of garbage collection [1]. Any automatic memory management is garbage collection. There is in fact a continuum of memory management strategies between full reference counting on one end and full stop-the-world mark/sweep on the other.

Malloc heuristics also mean that it is not true that everything is 100% deterministic at runtime. It's easy to forget that malloc is simply an abstraction like any other. When do free memory blocks get reshuffled between threads in a thread-caching malloc? When does unused memory get returned to the OS? These are all things that cannot be predicted. Even retain and release are not 100% deterministic, as they can and will be optimized away by the compiler.

[1]: https://www.memorymanagement.org/glossary/g.html#term-garbag...

Re:The origins of Objective-C at PPI/Stepstone and its evolu... by cat199 on Monday June 15, 2020 @02:24PM (#23531057)
reference counting is reference counting.

a reference counting gc is a form of garbage collection.

not sure what applies here, as am not versed in objc, but, the terms are distinct - in theory one can have an object system that refcounts objects so that they are not mis-deleted if some reference still exists and the object is accidentally deleted by some code, but still allow for mostly-manual memory management.

Re:The origins of Objective-C at PPI/Stepstone and its evolu... by jolux on Monday June 15, 2020 @09:02PM (#23534879)
We're discussing ARC here, i.e. Automatic Reference Counting, which is a garbage collection algorithm. Retain/release would be manual memory management by reference counting, which is not being discussed.
Re:The origins of Objective-C at PPI/Stepstone and its evolu... by cmrdporcupine on Monday June 15, 2020 @10:31PM (#23535406)
Even without ARC it's still garbage collection. The reference counts are kept for the purpose of managing garbage collection. That the programmer has to do some manual retain/release steps is beside the point, even if it does make the experience somewhat painful.
Re:The origins of Objective-C at PPI/Stepstone and its evolu... by PaulDavisThe1st on Sunday June 14, 2020 @05:12PM (#23521434)
It's not deterministic because you don't know the timing relationship between threads which may drop references. The only sense in which it is deterministic is that "when the reference count reaches zero, the object will be destroyed". That's a long way from the determinism of manual/explicit memory management. It gets even worse if there are per-thread pools in use, though to be fair, this is mostly an application design issue rather than a language one.
Re:The origins of Objective-C at PPI/Stepstone and its evolu... by jolux on Sunday June 14, 2020 @04:18PM (#23520951)
It’s not tracing GC, but it’s well-known as a garbage collection algorithm: https://en.wikipedia.org/wiki/Reference_counting#Garbage_col...
Re:The origins of Objective-C at PPI/Stepstone and its evolu... by ksec on Sunday June 14, 2020 @10:28AM (#23517850)
Well Objective-C wasn't doing well before iPhone. Then the smartphone revolution started and you are all forced to use it.

Ruby also never had much if any cooperate backing. MRI / CRuby is still by and large improved by people in their free time. It wasn't until the past 2 may be 3 years did Github and Shopify had some interest in the Ruby Runtime.

Re:The origins of Objective-C at PPI/Stepstone and its evolu... by pjmlp on Monday June 15, 2020 @01:28AM (#23524086)
In US, because plenty of us were already using J2ME, Brew and Symbian C++ before iPhone happened.