News for hackers. Stuff that matters.
Re:The Resurgence of C Programming by pavlov on Tuesday December 27, 2016 @04:44PM (#13266463)
I always felt that Objective-C was a great take on a "better C"... Definitely not conceptually better in the ways that Rust is, but simply better for a lot of the practical things where C suffers the worst.

Obj-C was an appealingly simple extension to C from the compiler point of view, but for a long time it was hobbled by the runtime/framework situation, as the NeXT/Apple runtime wasn't open source.

Just as that compatibility hurdle was getting fixed by open source efforts around 10 years ago, the iPhone happened and Apple went nuts with extensions to the language... It used to be that Objective-C proponents would brag that you can learn the syntax in 5 minutes if you know C. Now the language is filled with uncountable double-underscored keyword warts and @ declarations. Today's Obj-C looks more like an intermediate format for a Swift->C compiler rather than an evolution of Obj-C 1.0.

I understand completely why that happened. I just wish that Obj-C had gained more of an open source foothold when the opportunity was there, so it wouldn't have been so dependent on Apple's stewardship which eventually killed it as an independent language.

Re:The Resurgence of C Programming by WalterBright on Tuesday December 27, 2016 @07:53PM (#13267618)
Back in 1986 or so, there were two languages based on C: C++ and ObjectiveC. I was casting around looking for an edge with my C compiler, and investigated the two.

On usenet, there was about the same amount of traffic in the C++ and O-C newsgroups, the respective communities were about the same size.

Which should I choose? ObjectiveC was produced by Stepstone, and they wanted a royalty. C++ was produced by AT&T, and I phoned up their lawyer who said no royalty was required.

So I picked C++ based on that.

In 1987 I shipped the Zortech C++, the first native C++ compiler, and the popularity of C++ promptly zoomed. (Yes, I do think ZTC++ had a lot to do with the crucial early surge of C++ adoption, because the PC was where the programming action was at the time, not Unix.) The traffic in the C++ newsgroup exploded, and the ObjectiveC traffic crashed.

O-C was dead until Apple picked it up again later.

Re:The Resurgence of C Programming by tomcam on Wednesday December 28, 2016 @09:49AM (#13270769)
Dude's not wrong about Zortech's influence, young'uns. It was truly a game changer. Love the anecdote about calling the lawyer!
Re:The Resurgence of C Programming by WalterBright on Wednesday December 28, 2016 @10:04AM (#13270889)
I not only asked him about royalties, I asked him if I could call it "C++". He laughed, and said nobody had ever asked that before, they just did it. He was very nice and said I was welcome to use it.

I wish I remembered his name. He was a good guy.

I also remember how nice Andrew Koenig was to me in the early days. All the C++ people were nice, but Andy was a standout.

Re:The Resurgence of C Programming by pavlov on Wednesday December 28, 2016 @08:08AM (#13270210)
Great perspective, thank you! I would definitely agree that your early C++ compiler on DOS had a huge impact on the language's popularity.
Re:The Resurgence of C Programming by mpweiher on Tuesday December 27, 2016 @05:14PM (#13266676)
Hear hear!

And then I watch something like Gary Bernhard's "Boundaries" talk[1], which isn't bad, mind you, and think "maybe this Brad Cox guy with his Software ICs really knew what he was talking about?"

Where Apple went off the rails with Objective-C was trying to make it into an OO language like Java. It isn't. It is a deliberate hybrid, with a component implementation language ("C") married to a component connection language ("Objective").

My own approach is to take this distinction seriously, and instead of doubling down on the "better Java" part like Swift does (which in Software-IC terms is focusing on the less interesting and mostly solved component implementation part) and instead expand on the ways we can connect components (dataflow, constraints, storage composition, etc.).[2]

Minor correction: GNUStep, libFoundation etc. happened around 20 years ago, not 10.

[1] https://www.destroyallsoftware.com/talks/boundaries

[2] http://objective.st/

Re:The Resurgence of C Programming by Volt on Tuesday December 27, 2016 @07:51PM (#13267611)
>trying to make it into an OO language like Java. It isn't.

Can you elaborate? In what ways?

Re:The Resurgence of C Programming by pcwalton on Wednesday December 28, 2016 @09:29AM (#13270662)
Objective-C is just an idiosyncratic COM-like system with first-class language support (something that COM desperately needed). There's a performance ceiling with Objective-C that C++ doesn't have, due to some key decisions early on that make it much more like COM than C++—pervasive atomic reference counting everywhere, mandatory heap allocation, virtual dispatch requiring (caching) hash table lookups, and so forth.

I think if Objective-C had caught on and C++ hadn't, the performance-critical world would look very different: you'd probably just see those domains stick to C.

Re:The Resurgence of C Programming by pavlov on Wednesday December 28, 2016 @11:18AM (#13271467)
I honestly wouldn't mind a world where Obj-C had been used to filled all the COM-shaped holes in PC operating systems, including Windows and Linux desktop...

Obj-C is a great solution for messy GUI code and OO plumbing when you still need seamless C interoperability. COM and its various C++ wrappers tried to solve the same problem, but fell short in so many ways. On Linux, Qt and Gtk+ both built their own incompatible and inferior solutions to the same problem.

Re:The Resurgence of C Programming by eschaton on Tuesday December 27, 2016 @05:10PM (#13266642)
The NeXT/Apple Objective-C runtime has been Open Source since the late 1990s, the API and ABI have been documented since the late 1980s so anyone could create a compatible runtime, and GCC has had a portable runtime almost since Objective-C was taken into its mainline.
Re:The Resurgence of C Programming by favorited on Tuesday December 27, 2016 @05:12PM (#13266649)
I can agree about the nullability annotations & generics additions, but having properties, ARC, & blocks made writing Objective-C programs so much nicer, IMO.
Re:The Resurgence of C Programming by blub on Wednesday December 28, 2016 @06:12AM (#13269820)
Objective-C will slowly move to where it belongs - the dustbin of programming language history.

Merging C with a higher-level language could only make sense in the 80s, where people didn't know better and invited all the dreadful problems of C code into application development.

Swift is the proof that one can have a safe, powerful language that can also be fast. It's not yet fully mature, but it will get there, the speed at which it's replacing Obj-C in iOS and macOS development is impressive.

Re:The Resurgence of C Programming by 35bge57dtjku on Wednesday December 28, 2016 @10:49PM (#13275519)
I've never seen its syntax not look bad enough that I immediately abandoned all hope of using it ever.