Live data from Hacker News

Why Objective-C

inessential.com

101–110 of 160 posts

Re: Why Objective-C

#102

I really miss Objective-C, and in the world of Swift craziness [1] I'm reminded often of this blog post [2] wondering what would have happened if Apple hadn't encountered Second System Syndrome for its recommended language. (There's a decent argument it encountered it in iOS and macOS too.) [1] https://github.com/swiftlang/swift-evolution/blob/main/propo... -- apologies to the authors, but even as a previous C++ guy,…

Obj-C’s simplicity can be nice, but on the other hand I don’t miss having to bring in a laundry list of CocoaPods to have features that are standard in Swift. I don’t miss maintaining header files or having to operate in old codebases that badly manage Obj-C’s looseness either.

You can simply import Swift packages and either they expose an Objc interface or you can provide it yourself – by wrapping it in Swift and exposing the things you need via @objc etc. You can - at the same time - also hide the wrapped framework and make it an impl. detail of the wrapper so that you could switch the wrapped framework while keeping your app code mostly stable. This also reduces the number of imported symbols… import 3rdPartyFramework imports all symbols, extensions, classes, types etc. vs. import MyWrapper only brings in the things you really need.

Re: Why Objective-C

#103
post #81

Earlier quoted context omitted.

The "Swift has too many keywords now" meme makes me want to go insane. The vast majority of Swift code never runs into any of that stuff; so, what advocates of it are saying is in effect "we don't want Swift to expand into these new areas (that it has potential to be really good at) even if it's in a way that doesn't affect current uses at all." That said, the Swift 6 / Strict Concurrency transitions truly have been…

Swift's concurrency story is what happens when a multi-year project meets Apple's fixed six month Swift release timeline. And being written by highly knowledgeable but low level engineers who've never written an iOS app in their life, means that there was a huge approachability hole they've only recently worked their way out of, but even that has major issues (MainActor default on in Xcode but not Swift itself).

Such a mess. You can tell the people that designed it never wrote a client or an app in their lives. It is pure academic pendatry in display.

Re: Why Objective-C

#104

I really miss Objective-C, and in the world of Swift craziness [1] I'm reminded often of this blog post [2] wondering what would have happened if Apple hadn't encountered Second System Syndrome for its recommended language. (There's a decent argument it encountered it in iOS and macOS too.) [1] https://github.com/swiftlang/swift-evolution/blob/main/propo... -- apologies to the authors, but even as a previous C++ guy,…

I go back and forth. I do miss the simplicity of objc at times though. I think in a short amount of time someone can become close to an expert in objc. Swift is already incredibly complicated and there's no end in sight.

I hate how pendantic and useless some of the features of swift being pushed down by academics that don't write apps or services themselves.

Simple example:

Objective-C

if myObject {

}

in swift if myObject != nil {

}

Also opitionals in swift could have totally be avoided if they adopted a prototype based langue (basically object are never nil). Lua did this, and it is very elegant

But meanwhile, we got a half backed optional system, which is backwards (similiar to Java), and didn't help with the practicality of the language at all, and meanwhile you still can crash an app doing myArray[1]

Re: Why Objective-C

#105

I really miss Objective-C, and in the world of Swift craziness [1] I'm reminded often of this blog post [2] wondering what would have happened if Apple hadn't encountered Second System Syndrome for its recommended language. (There's a decent argument it encountered it in iOS and macOS too.) [1] https://github.com/swiftlang/swift-evolution/blob/main/propo... -- apologies to the authors, but even as a previous C++ guy,…

I go back and forth. I do miss the simplicity of objc at times though. I think in a short amount of time someone can become close to an expert in objc. Swift is already incredibly complicated and there's no end in sight.

A few years from now O'reilly will publish a bestseller called Swift: The Good Parts

Re: Why Objective-C

#106

Earlier quoted context omitted.

One of my recurring language design hot takes is that it's easier to design for speed and then make it easy to use than it is to make it easy to use and then try to speed it up.

C++ is trying to make C easier to use for 40 years, and it's still not there. So I wouldn't call that easier.

how would you write something like

    #include 
    #include 
    #include 

    int main(int argc, char** argv) 
    {
      using namespace std::literals;

      std::string foo = "foo:";
      foo += argv[0];

      std::map m{
        {foo, 123}
      , {"count: "s + std::to_string(argc), 456}
      };

      std::println("{}", m);
    }
in C

Re: Why Objective-C

#107

At this point in my career, I can't go back to a language that doesn't have support for Optionals or compiler validation of nullable types. I can sacrifice async or fancy stream apis, but I will never go back to chasing null pointer exceptions on a daily basis.

I don't think objc has the equivalent of a null pointer exception. You can freely send messages to a deallocated object. Since ARC, it is rare, at least in my experience, running into any memory related issues with objc.

You can send messages to `nil`, but the inverse isn't universally true. APIs like

  [text stringByAppendingString:other]; 
will throw an `NSInvalidArgumentException` if `other` is nil.

Re: Why Objective-C

#108

I recently started writing for macOS in Swift and, holy hell, the debuggability of the windowing toolkits is actually unparalleled. I've never seen something that is this introspectable at runtime, easy to decompile and analyze, intercept and modify, etc. Everything is so modular, with subclassing and delegation patterns everywhere. It seems all because of the Objective-C runtime, as without it you'd end up needing s…

  > I feel like I must be in some sort of honeymoon phase but I 100% completely understand now why many Mac-native apps are Mac-native.
it seems like everybody prefers ios, but i really still think after all these years i prefer appkit; it really is so well documented and the quality of the api is the best i've seen by a long mile

Re: Why Objective-C

#109

Earlier quoted context omitted.

I go back and forth. I do miss the simplicity of objc at times though. I think in a short amount of time someone can become close to an expert in objc. Swift is already incredibly complicated and there's no end in sight.

I hate how pendantic and useless some of the features of swift being pushed down by academics that don't write apps or services themselves. Simple example: Objective-C if myObject { } in swift if myObject != nil { } Also opitionals in swift could have totally be avoided if they adopted a prototype based langue (basically object are never nil). Lua did this, and it is very elegant But meanwhile, we got a half backed o…

  > you still can crash an app doing myArray[1]
the first thing i do when starting a new project:

  extension Array {
      subscript(safe: Int) -> Element? { ... }
  }
there was talk in the swift forms about adding that as standard that but it seems to have died off...

[0] https://forums.swift.org/t/draft-adding-safe-indexing-to-arr...

Re: Why Objective-C

#110

Someone should vibe code Objective-C 3.0

What features do you think it needs, that wouldn't spoil the "elegance" of the language? I think one good feature would be higher order messaging, in fact there's already a PL paper discussing how it looks like in objective-c [1] which would add FP-like filter/map elegance that all modern languages have. This would go nicely with simpler "JS lambda" style block syntax to make functional-style programming easier in objc.

[1] https://dl.acm.org/doi/epdf/10.1145/1146841.1146844

Post reply on HN