views:

143

answers:

3

After reading Is a virtual machine for Cocoa programming inevitable?, I'd like know what is the language in your mind if the replacement really happens, and why?

Fixable complaints in the language and APIs include

  • the lack of tuples, slices, maps or associations at a syntax level;
  • the lack of template programming;
  • the lack of namespaces;
  • the lack of default parameters to methods;
  • the lack of operator overrides/overloading;
  • leaks and premature collection by the garbage collector;
  • the wordy, camel-coded naming conventions;
  • the lack of package management;
  • the lack of out-of-the-box support for "business" APIs like REST, SOAP, SQL, etc.
  • Even the commonly mocked square bracket method invocation syntax could be changed if the need existed.

p.s. one language per answer please.

A: 

Objective-but-not-C, a language that borrows a lot of syntax and methodology from Objective-C but does away with the direct access memory model and primitive arrays. It would be an entirely new language designed by Apple with compatibility (probably even binary compatibility) with the Objective-C runtime library.

The result would be a to Objective-C as Microsoft Managed C++.NET is to C++. In fact, if Apple were to use a VM like LLVM in the same way that Microsoft uses the .NET CLR, then other languages such as Ruby, Python etc. could easily interoperate with "Objective-but-not-C" code.

Graham Lee
Why not just call the language "Objective"?
JAB
@JAB: because "SmallTalk" is a more accurate name.
Graham Lee
In other words, given your comparison, the result would be a hack job dropping features of Objective-C to fit into a model it wasn't intended to go into?
David Thornley
@Graham Lee: Ah, so it'd effectively be a Smalltalk implementation that uses the Cocoa libraries. @David: http://en.wikipedia.org/wiki/Smalltalk
JAB
@David: yes, because the model Objective-C _was_ intended for is irrelevant in modern computing. Check out Brad Cox's book.
Graham Lee
@Graham Lee: Your comparison was that it would wind up like "Microsoft Managed C++.NET is to C++". Managed C++ and C++/CLI are, shall we say, not well respected by C++ experts.
David Thornley
And C++ experts aren't well respected by Objective-C experts.
Graham Lee
@Graham Lee: That's a harsh thing to say. It's true that C++ experts aren't Objective-C experts as a rule, but I don't see why that should imply lack of respect. I said nothing about Objective-C, only about C++ and your comparison.
David Thornley
+2  A: 

MacRuby, an implementation of Ruby that uses the LLVM compiler and bases all of its objects on the Objective-C runtime library (and on normal Cocoa classes like NSString, NSArray). It's completely interoperable with ObjC so existing code can be integrated with MacRuby code. Indeed ObjC could be used as a systems programming language in the same way that the JVM and parts of the Java class library are written in C, not Java.

Essentially I think any replacement language must be interoperable with Objective-C, will be object-oriented, and will have completely managed access to memory.

Graham Lee
as demonstrated by the iphone wax project, how's lua compare to ruby, in terms of interoperability?
ohho
@Horace don't know, I have no experience with Lua.
Graham Lee
Ruby has strong object orientation, Lua doesn't, so in that respect I would expect Ruby to be a better match. Apart from that, there are various pros and cons for both, but in general, I expect MacRuby to be an exceptionally strong platform for writing OS X apps.
Felixyz
Given the amount of resources Apple is throwing behind MacRuby, I'd better dollars to doughnuts that MacRuby would be Objective-C's replacement *if* Apple decides to ditch Objective-C.
mipadi
+5  A: 

How valid are the complaints:

Fixable complaints in the language and APIs include

  • the lack of tuples, slices, maps or associations at a syntax level;

So what?

  • the lack of template programming;

Is this C++ templates? Then use Objective-C++. Personally, I think it's a plus point that we don't have them in Objective-C.

  • the lack of namespaces;

This one is valid. I'd dearly love name spaces.

  • the lack of default parameters to methods;

This is another feature I am glad is not in Objective-C

  • the lack of operator overrides/overloading;

This is another feature I am glad is not in Objective-C

  • leaks and premature collection by the garbage collector;

So fix the garbage collector bugs.

  • the wordy, camel-coded naming conventions;

I like the wordy naming conventions. It makes the code easier to read. OTOH if you are a person who doesn't note thatthese are only conventions. The compiler doesn't force you to use them.

  • the lack of package management;

Packages would be nice.

  • the lack of out-of-the-box support for "business" APIs like REST, SOAP, SQL, etc.

There are plenty of libraries available for these.

  • Even the commonly mocked square bracket method invocation syntax could be changed if the need existed.

Commonly mocked by people who don't really use the language. When I first started C I hated a lot about the syntax, but you get used to it.

I see no pressing reason to change anything about Objective-C except to add name space support. So that's my answer: Objective-C.

JeremyP