News for hackers. Stuff that matters.
Re:Object-oriented design patterns in C and kernel development by mettamage on Wednesday August 27, 2025 @02:37PM (#45043315)
So why did Swift become a thing? Or does Swift has this too?
Re:Object-oriented design patterns in C and kernel development by bitwize on Wednesday August 27, 2025 @05:52PM (#45045781)
Because Objective-C does not have foo.bar() style method calls and that's what everybody else uses and wants.
Re:Object-oriented design patterns in C and kernel development by saagarjha on Wednesday August 27, 2025 @09:01PM (#45047120)
Because Swift adds many other features.
Re:Object-oriented design patterns in C and kernel development by astrange on Wednesday August 27, 2025 @09:10PM (#45047177)
Swift isn't messaging-based, it's protocol-based. (Except it's also messaging-based if you use @objc.)
Re:Object-oriented design patterns in C and kernel development by pjmlp on Thursday August 28, 2025 @02:14AM (#45049000)
Because Objective-C being based on C, means it would never be safe while remaining compatible with C.

Also dynamic runtime dispatch Smalltalk style can never be as fast as the VMT based dispatch, or compile time dispatch via generics, even with all the optimizations in place, that objc_msgSend() has had during its lifetime.

Still, Metal is implemented in Objective-C, so there is that.

Re:Object-oriented design patterns in C and kernel development by 1718627440 on Thursday August 28, 2025 @01:29PM (#45054778)
Objective-C already has a different compiler I fail to see how the compiler is restricted in the checks it does.
Re:Object-oriented design patterns in C and kernel development by ryao on Thursday August 28, 2025 @05:08PM (#45057058)
There is always a subset of the population for which it is fashionable to try to make a new language to make things easier. It is inevitable that someone in a sufficiently large organization will try to make one, provided management supports it. Apple is a very wealthy company that is happy to sponsor R&D, had someone interested in this that they sponsored and the result was appealing enough that they decided to adopt it.

That is my understanding of how the process generally works and what I am willing to guess happened. Prior to this, they had been making incremental changes to Objective-C.

That said, from what I have seen of the syntax of both languages, swift’s syntax is nicer and that is not something that they would have been able to get from Objective-C. They already had tried syntax reform for Objective-C once in the past and abandoned it.