ObjC is so hard to read!!! Meanwhile…
Nope, no issues here.
I'm stuck in Swift land for at least the next week, so expect a lot of moaning and groaning. There's for sure some parts that I like about it, if they had a version with maybe 1/4 of the features (i.e. needless complexity) I might actually say I'd enjoy using it.
Oh and bring back F*****' header files you crazy bastards!
@paul … but that was the worst part 🫣
@paul Oh gods no! 😱
@paul Hmm, I'd like to see dynamic, read only header files that are automatically generated from the main file so I can use them to skim the interfaces and generate errors when my code makes no sense
Yesterday's Swift week highlight was spending at least an hour trying to find the right annotations to tell the compiler/concurrency stuff what a couple methods do threading wise. Turns out I had the right combo from the get go but it’s broken in both Xcode 26.2/4 and fixed in the .5 beta. Couldn't tell in older Xcodes because Apple blocks old Xcodes from running in current OSes for "reasons”.
Swift's concurrency approach is emblematic of its complete lack of pragmatism. Runtime sees hey I think this code is running in the wrong thread (or context if you must) what do I do? Warn and ignore, because it's probably OK 99% of the time, nope. Warn and correct, because you have enough info to infer what is probably needed, nope. How about crash 100% of the time, yep, that's the one.
@paul There are domains where you probably want that (kernel stuff, secure code) and domains where leniency would be better. But Swift is everywhere.
@stevex 100% and even times where you want it (debugging) and times when you don't (AppStore).
@paul they reason about (other) developers like this: if they were any good they would be writing the swift core. So how do we force them to address their concurrency problems? Make it crash. They’ll have to sort it out then. It’s not pragmatism they lack, it’s an excess of self righteous arrogance. It’s just a bunch of language nerds who never build anything.
@paul “warn and ignore” will get ignored by nearly every developer even those with good intentions (especially with the spam factory that is revealed in Console.app). Not sure if "warn and correct" is feasible, you'd know better than me since I nope’d out. Crashing unambiguously is almost always the best option since the developer can more easily find and fix the issue. As annoying as it is, it's 1000x better than some very rare bug that can't be reproduced and only manifests visibly minutes or hours after the problem and potentially corrupts user data along the way.
@paul wait Ivory is Obj-C?
@paul Out of curiosity, how much if this is Swift's fault and how much the libraries?
@paul I've stayed on Swift 5 and been happy. The day I'm forced onto Swift 6 I'm sure I'll complain.

@paul « a version with maybe 1/4 of the features (i.e. needless complexity) »

That'd be Dart (what is used for Flutter).

@paul I used a similar example in a talk on how Cobol works. I said something like "Oh, you think Cobol is wordy, huh? Then what do you say about this code in a modern language calling a modern API?" Although come to think of it, my example might have actually been in ObjC…
@waltman syntax is always clearer on the other side.

@paul Here's the example I used:

NSString *yourString = [whitespaceString stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceCharacterSet]];

NSString *yourString = [whitespaceString stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];

I originally did this talk for a Perl conference. As you can imagine, the equivalent code is a LOT shorter in Perl. 😀

@waltman why twice or was it just examples of trimming differently.

@paul Are `whitespaceCharacterSet` and `whitespaceAndNewlineCharacterSet` two different constants in the API? I'm sure I just copied that from the API docs but I don't remember. In any event, in Perl you'd either use `chomp` or a very simple regex if you wanted finer control. That second command would be something like

$yourString =~ s/\s+$//;

in Perl.

@waltman the newline one is a superset of the whitespace one, so you only need to trim that. And while yeah that particular API is a bit long winded it's just a method that takes a single argument and returns something.
@paul @waltman Not if you want to retain the newline. (I’m assuming these are supposed to be two different examples)

@pdcawley @paul I thought the second example was supposed to trim the newline, so that's why I went with that example. My intention wasn't to give every possibility but just demonstrate what the equivalent Perl code might look like. It's easy enough to use a character class in your regex to remove anything you want.

That said, I'm having a hard time thinking of a case where I wanted to trim trailing whitespace and *not* also trim the newlines. Maybe it comes up more often in GUI programming than CLI tools?

@paul is there a super boost button on this thing? 10+ years in and I still don’t get this argument.
@chadpod @paul The Emperor’s New Clothes is strong with Swift. Unreadable. I only use it when there’s no other alternative, which is in surprisingly few places. I think I have 5 Swift files in my >2K source files. 😄
@paul frack swift.
@paul you know it’s not good when Lattner himself hasn’t said positive things about Swift in years.
@paul « C++ STL wasn’t a sorry that others needed to follow »
@paul I just threw up a little in my mouth.
@paul needa more @unchecked
@paul 😂❤️ I still love ObjC but I'd be curious to see how a signature that achieves the same goal would look in ObjC.

@paul I miss objective C. It’s a cobbled together mess of a language in many ways, and I’d love a cleaned up version. But even then it’s one of my favorite languages because of how effortless it is.

Coded in 10+ languages over 27+ years professionally and tried a bunch more. ObjC is still so good. I’m sad that swift is a better C++ and not a better ObjC.