Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Its not worth the effort.

A, Its hard to fill a cup that is already full. (Or in this case its hard to fill a cup with no lid)

I'm going to accept that as a compliment :)

B, you know absolutely nothing about the language, as shown by your example above.

What example?

C, you accuse me of not accepting other ideas yet you do EXACTLY the same thing.

What ideas aren't I accepting?

What makes your arguments even more dodgy than an aeroplane made out of cardboard is your example. You have NO CLUE about the Objective-C Language.

Fair enough. What example?

EDIT: If your talking about the code example, you might have inadvertently shot yourself in the foot there. That is known as a closure (or a block more specifically) and is supported in the current Objective C. It's cool that obj C have them (Java does not) but the syntax is hardly "self documenting". In fact, if I guess correctly it looks so foreign to you that it seemed to be a mistake on my part.

Here is a more in-depth explanation: http://www.informit.com/articles/article.aspx?p=1353398&seqNum=7. I would encourage you not to email him saying he doesn't know what he's talking about.
 
I'm going to accept that as a compliment :)

Look up the phrase, its not a compliment.

What example?

arr = [arr map:^(id obj){ return [obj uppercaseString]; }];

What happened to this? This is code I expect from a Visual Basic program.

Why on earth are you performing a bitwise operation?

This looks like massively overboard cargo-cult programming.

What ideas aren't I accepting?

Meyer and I have already gone over this.
 
arr = [arr map:^(id obj){ return [obj uppercaseString]; }];

What happened to this? This is code I expect from a Visual Basic program.

Why on earth are you performing a bitwise operation?

This looks like massively overboard cargo-cult programming.

See above. I agree that it looks horrible. That was my point.
 
Its not valid Objective-C syntax to begin with.

Yes it is.

You have no point, you know nothing of the language. This argument is over, I have more productive things to do than argue with someone who has their head in the sand.

Try this:

Code:
#import <Foundation/Foundation.h>

@interface NSArray (Mapping)

-(NSArray *)map:(id (^)(id obj))block;

@end

@implementation NSArray (Mapping)

-(NSArray *)map:(id (^)(id obj))block; {
    NSMutableArray *result = [NSMutableArray arrayWithCapacity:self.count];
    for (id obj in self) [result addObject:block(obj)];
    return result;
}

@end

int main() {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    	
    NSArray *arr = [NSArray arrayWithObjects:@"it", @"works", @"as", @"if", @"by", @"magic", nil];
    NSArray *upper = [arr map:^(id obj) { return (id)[obj uppercaseString]; }];
    NSLog(@"%@", upper);
	
    [pool drain];
    return 0;
}

If you want to know why this is useful you should probably look into Ruby which is famous for its use of blocks. That would definitely be more productive than being repeatedly wrong on the interwebs.

By the way, the equivalent code in Ruby is:

Code:
arr = ["it", "works", "as", "if", "by", "magic"]
puts arr.map {|s| s.upcase}

...or you could mutate the array directly:

Code:
arr = ["it", "works", "as", "if", "by", "magic"]
arr.map! {|s| s.upcase}
puts arr

...or you could just do it in one line:

Code:
puts ["it", "works", "as", "if", "by", "magic"].map {|s| s.upcase}
 
I have a small feeling that the new addition to the agreement will be used for Unity. I mean Apple has been promoting Unity made games for the iPhone ever since they release Unity iPhone at Apple conferences and gathering (hell, they even had Unity at the WWDC to announce the release Unity 1.0 even tho at that time there was no iPhone support). From what I have been told, Apple very recently sent out flier to europe featuring Unity made games.

Then again I would not put it passed Apple to make Unity incorporate c++/objective-c as a scripting language to stay complaint.
 
I have a small feeling that the new addition to the agreement will be used for Unity. I mean Apple has been promoting Unity made games for the iPhone ever since they release Unity iPhone at Apple conferences and gathering (hell, they even had Unity at the WWDC to announce the release Unity 1.0 even tho at that time there was no iPhone support). From what I have been told, Apple very recently sent out flier to europe featuring Unity made games.

Then again I would not put it passed Apple to make Unity incorporate c++/objective-c as a scripting language to stay complaint.

Is Unity actually interpreting the scripting code, though? And wouldn't that completely invalidate the "3rd party meta-platforms are bad" argument? And wouldn't it be about time for Apple to actually inform Unity whether they comply or not?
 
Yes it is.



Try this:

Code:
#import <Foundation/Foundation.h>

@interface NSArray (Mapping)

-(NSArray *)map:(id (^)(id obj))block;

@end

@implementation NSArray (Mapping)

-(NSArray *)map:(id (^)(id obj))block; {
    NSMutableArray *result = [NSMutableArray arrayWithCapacity:self.count];
    for (id obj in self) [result addObject:block(obj)];
    return result;
}

@end

int main() {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    	
    NSArray *arr = [NSArray arrayWithObjects:@"it", @"works", @"as", @"if", @"by", @"magic", nil];
    NSArray *upper = [arr map:^(id obj) { return (id)[obj uppercaseString]; }];
    NSLog(@"%@", upper);
	
    [pool drain];
    return 0;
}

If you want to know why this is useful you should probably look into Ruby which is famous for its use of blocks. That would definitely be more productive than being repeatedly wrong on the interwebs.

By the way, the equivalent code in Ruby is:

Code:
arr = ["it", "works", "as", "if", "by", "magic"]
puts arr.map {|s| s.upcase}

...or you could mutate the array directly:

Code:
arr = ["it", "works", "as", "if", "by", "magic"]
arr.map! {|s| s.upcase}
puts arr

...or you could just do it in one line:

Code:
puts ["it", "works", "as", "if", "by", "magic"].map {|s| s.upcase}

That code returns me several Syntax errors.

I've had enough of your BS.
 

Attachments

  • Picture 1.png
    Picture 1.png
    207.9 KB · Views: 142
That code returns me Syntax error.

It only works on Snow Leopard. As I mentioned (and is mention in the article I referred you to) it is supported by the current version of objective C. Try compiling against 10.6.

If someone is running on a current version of XCode on SL, feel free to chime in. :)
 
It only works on Snow Leopard. As I mentioned (and is mention in the article I referred you to) it is supported by the current version of objective C. Try compiling against 10.6.

What article?

Ruby blocks are just Procs (or procedures) BTW.

I think what you're trying to do would've been better to reproduce in C, not Objective-C. Or a mixture of TypeDef or structs. I really do suggest you look up the definition of cargo cult programming. You're dissing a language because it doesn't do what you want to do. So? Neither does C# or VB, but you don't see me trolling around a .Net forum?

Maybe I should start dissing Ruby because it has shoddy ORM schemes? Or that it doesn't have decent integration with OpenGL? Or that it takes the Relational out of Relational databases?

Please stop this drivel.

---

I'm sorry Objective-C is still at 2.0.

Foundation and Cocoa is not Objective-C, they're not a language. You're wrong again. Even then, blocks is implimented in the LLVM virtual machine/runtime, not the language.

EDIT: Still errors
 

Attachments

  • Picture 2.jpg
    Picture 2.jpg
    203.9 KB · Views: 111
What article?

Sheesh. :rolleyes: Here it is again: http://www.informit.com/articles/article.aspx?p=1353398&seqNum=7

Ruby blocks are just Procs (or procedures) BTW.

Not completely incorrect but Procs are not just procedures.

I'm sorry Objective-C is still at 2.0.

I'll give you that. It is actually a feature of Clang. Nevertheless, it works on Snow Leopard.

Foundation and Cocoa is not Objective-C, they're not a language. You're wrong again.

Have I said otherwise?

Just to reiterate my point. Closures are cool. They should be incorporated into methods by Apple in the standard library but they are not self-documenting in any way. The rest is based on you being repeatedly wrong.

Now, I realize you are in nitpicking mode and you can definitely find a few other points that wasn't completely clear (such as a block not necessarily being a closure) but that would require some reading on your part. In other words, feel free (but it is probably off-topic in this thread) :)

EDIT: Still errors

It works here against 10.6 | Debug | x86_64 on Snow Leopard
 
Sheesh. :rolleyes: Here it is again: http://www.informit.com/articles/article.aspx?p=1353398&seqNum=7



Not completely incorrect but Procs are not just procedures.



I'll give you that. It is actually a feature of Clang. Nevertheless, it works on Snow Leopard.



Have I said otherwise?

Just to reiterate my point. Closures are cool. They should be incorporated into methods by Apple in the standard library but they are not self-documenting in any way. The rest is based on you being repeatedly wrong.

Now, I realize you are in nitpicking mode and you can definitely find a few other points that wasn't completely clear (such as a block not necessarily being a closure) but that would require some reading on your part. In other words, feel free (but it is probably off-topic in this thread) :)



It works here against 10.6 | Debug | x86_64

"As I mentioned (and is mention in the article I referred you to) it is supported by the current version of objective C."

You have said otherwise. The current version of Objective-C is V2.0.

Clang is just a compiler. Blocks are in the LLVM virtual machine.

I'm in knitpick mode because you cant get your terminology right.
 
"As I mentioned (and is mention in the article I referred you to) it is supported by the current version of objective C."

You have said otherwise. The current version of Objective-C is V2.0.

And I, again, have said that I'll give you that point.

Clang is just a compiler. Blocks are in the LLVM virtual machine.

In order for LLVM to understand what is going on, it needs to be implemented in the front end. Thus it is implemented in Clang. I don't know if LLVM has any notion of blocks.
 
I think what you're trying to do would've been better to reproduce in C, not Objective-C. Or a mixture of TypeDef or structs. I really do suggest you look up the definition of cargo cult programming. You're dissing a language because it doesn't do what you want to do. So? Neither does C# or VB, but you don't see me trolling around a .Net forum?

Maybe I should start dissing Ruby because it has shoddy ORM schemes? Or that it doesn't have decent integration with OpenGL? Or that it takes the Relational out of Relational databases?

Please stop this drivel.

Ah, I missed this the first time around. Allow me to clarify. I think the Objective C syntax is atrocious. I think the features of the language are nice, but the syntax is in my opinion not in any way particularly readable or self-documenting.

Now, with regards to cargo cult programming it is, according to wikipedia, "characterized by the ritual inclusion of code or program structures that serve no real purpose." Closures serve a purpose. It is inspired by functional programming and the construct is very powerful while being readable if used correctly. Again, I encourage you to check out Ruby.

In addition, it is parallelizable which is a rather nice thing to have with multicore CPUs.

Also, I'm not setting up Ruby as the perfect language just as I'm not a proponent of Java as mdriftmeyer immediately assumed. You seem to have this strange notion that any criticism based on other languages means that I think these languages are perfect. Sure, I think the syntax is much nicer, but feel free criticize these languages as much as you want. It's not going to hurt my feelings, and I can come up with a few tidbits myself.

For example, it is possible in Ruby to have dead code with side effects which is not nice at all. I actually commented on this in a Ruby forum a while back and the reaction wasn't kicking and screaming but instead: "Yep, you're right about that but in practice I've found that it bites you once and then you learn"; a completely sensible response. Now compare that to your own responses.

I think it would be a cool project for Apple to design or incorporate a modern language to be used instead of Objective C. After all, design is what they do.

It would definitely be interesting if they applied the same philosophy the use in UI design in language design. In addition, Apple see themselves as a cutting edge company and routinely weed out the old - except Objective C.

I realize that Apple will not do this but that doesn't automatically mean that I'm wrong or that I'm trolling, which I'm not.

There is a lot of great ideas implemented in languages other than Obj C and IDEs other than XCode. Again, that doesn't mean that other languages or IDEs are perfect, but to deny these facts as "trolling" is ignorant. Especially when you don't even know the features of the language you are actually promoting.

I realize this discussion will go nowhere with people such as yourself but I've had my say, I guess.
 
The User Experience is certainly improved if the game actually ships, which it probably wouldn't do if the all the game logic had to be written in a compiled language like C++.

I still don't understand why people can't grasp this concept. Games have been written this way for years - the game logic for Quake (1996) is all written in QuakeC - an interpreted language!

Thanks. But it's probably best to just drop this as the "elite" devs here started to discuss something as mundane as frigging syntax - talk about missing the point. But they are following Steve's teachings so who could we blame them.

Funny thing is I have worked and spoken with some of the absolutely most renown developers in the games industry and all of us share the same view that this is nothing but an attempt to crush competition. The really scary part is people actually believe this BS, and I'll get badmouthed for this by these forum "professionals".

There really is a reason for interpreted logic, had been for 15 years, so it is hilarious that the forum dwellers are talking about lazyness. Guess Carmack is also lazy then.
 
Is it or me or is it blatantly obvious by now that MorphingDragon has absolutely NO idea what he's talking about? He can't even do something as simple as compile a program - LOL.

Not to mention his argument has been debunked a thousand times. Obviously he has never coded in his entire life.
 
Apple, incase you have lived under a rock these past ten years, is all about the user experience. They take it REALLY seriously and i believe it might have the reason so many Mac users stuck with the platform through the lean times. Jobs understands this and is constantly saying it in interviews that they want to make the best product they possibly can.
Nothing says "quality" like having more than 20 variants of iFart in the App Store.

That's the great thing about Objective-C: it makes it impossible to design useless or ugly apps. Amazing stuff.
 
Nothing says "quality" like having more than 20 variants of iFart in the App Store.

That's the great thing about Objective-C: it makes it impossible to design useless or ugly apps. Amazing stuff.

seriously. isn't it amazing how easy some people trust the apple marketing machine word-for-word while contradictory proof is in plain sight?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.