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
@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.