Live data from Hacker News

Why Objective-C

inessential.com

151–160 of 160 posts

Re: Why Objective-C

#151
post #93
post #71

Earlier quoted context omitted.

What C features can you not realistically use from C++?

C11 atomics, C11 threads, variable length arrays, safely reading from an inactive union member, designated array initializers, compound struct literals, implicitly converting a void pointer to a typed one, and the list goes on.

C++ has its own atomics, threads etc. And variable length array's work just fine in C++ in both clang and GCC.

C++ also has it's own designated initializer like syntax.

Re: Why Objective-C

#152
post #71

Earlier quoted context omitted.

What C features can you not realistically use from C++?

Any language feature added in C99 and later. In GCC and Clang it's quite relaxed since their C++ frontends pull in a couple of modern C features as non-standard C++ extensions, but MSVC has a strict separation between the C++ and C frontend and doesn't allow this sort of 'cross-pollution'. As a quick example, this C99 code block has at least 4 features that don't work in C++: https://github.com/floooh/sokol-samples/b…

Nothing of value was lost

Re: Why Objective-C

#153
post #151
post #93

Earlier quoted context omitted.

C11 atomics, C11 threads, variable length arrays, safely reading from an inactive union member, designated array initializers, compound struct literals, implicitly converting a void pointer to a typed one, and the list goes on.

C++ has its own atomics, threads etc. And variable length array's work just fine in C++ in both clang and GCC. C++ also has it's own designated initializer like syntax.

>C++ has its own atomics, threads etc.

It does indeed, but they are not compatible and at least the C atomics cannot be used from C++.

>C++ also has it's own designated initializer like syntax.

One that is far more limited. This is valid C, but not C++.

  struct bar {
      int a;
      int b;
  };
  
  struct bar tmp = {
      .b = 0,
      .a = 0,
  };

Re: Why Objective-C

#154

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 never have to miss Objective-C because I still write in it! I never hopped on the Swift train because I saw it as an inferior language to Objective-C. And a decade later I'm more sure of that. It's such a joy to still write in an amazing language. Yes I use Python too and that is a joy. But nothing like Objective-C.

Re: Why Objective-C

#155
post #2

Good time to check out ObjFW [1], it's a cross platform ObjC framework that's just really awesome [1] https://git.nil.im/ObjFW/ObjFW

It really is really awesome! It's what I write in when I want to use it on Linux.

GNUStep is stuck in 1995 sadly.

Re: Why Objective-C

#157

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 ob…

Probably something like this, all it really needs to do is absorb the good parts of Swift and unfuck the actors/concurrency: https://github.com/doublemover/Slopjective-C

I don't know if I like what that paper is suggesting, but I will give it a rip.

Re: Why Objective-C

#158

Someone should vibe code Objective-C 3.0

If it makes Objective C 1.0 with ARC(but none of the swift-alpha Java syntax) and bindings for QT I won't even care it is made by AI.

Can you elaborate on this? I learned Objective-C not long after 2.0 came out so I do not have much perspective on what exactly you'd want. I remember looking at it and thinking it was pretty fragile and boilerplate-y

Re: Why Objective-C

#159

Earlier quoted context omitted.

If it makes Objective C 1.0 with ARC(but none of the swift-alpha Java syntax) and bindings for QT I won't even care it is made by AI.

Can you elaborate on this? I learned Objective-C not long after 2.0 came out so I do not have much perspective on what exactly you'd want. I remember looking at it and thinking it was pretty fragile and boilerplate-y

The nice thing about Objective-C up to 2.0 was that it was 100% an extension over C and all new semantics were using a new syntax. So you knew that the C code was C and performing like C while the Scheme code was Scheme and performing like Scheme by looking at it.

ARC semantics arguably follow this as you're using the Objective-C syntax for all occurrences of the Object. Reference counting is also great and predictable which is the main reason MRC was used in 1.0 until Apple decided it was too hard and introduced GC only for it to be canned shortly after as someone came up with the ARC solution.

With property syntax sugar, however, you can't tell whether "a.length" is sending a bunch of messages or simply accessing a struct which are two very dissimilar operations.

Re: Why Objective-C

#160

Earlier quoted context omitted.

Can you elaborate on this? I learned Objective-C not long after 2.0 came out so I do not have much perspective on what exactly you'd want. I remember looking at it and thinking it was pretty fragile and boilerplate-y

The nice thing about Objective-C up to 2.0 was that it was 100% an extension over C and all new semantics were using a new syntax. So you knew that the C code was C and performing like C while the Scheme code was Scheme and performing like Scheme by looking at it. ARC semantics arguably follow this as you're using the Objective-C syntax for all occurrences of the Object. Reference counting is also great and predictab…

@. or some other illegal combination would have been fine.
Post reply on HN