Live data from Hacker News

Apple's new Objective-C to Javascript Bridge

steamclock.com

31–40 of 110 posts

Re: Apple's new Objective-C to Javascript Bridge

#31
post #26

> The most interesting possiblility would be that this is the start of Apple’s evolution away from Objective-C into promoting a higher-level language for their platform The thing is: Why would they want to transform away? As it is now Obj-C is pretty sane. The memory management is now a non-brainer so that even people who come from managed languages can grasp it. GCD is great for concurrency. And using C and C++ base…

Maybe I've just swallowed the Kool-Aid, but I don't see the putative benefits of Apple's switching platforms. I'm also not clear on how many people there are who a) can write non-trivial software and b) can't learn a C derivative language who c) would actually write software for Apple's platforms. It just seems like a pretty small set. And, if Apple were to switch, why would they pick a language as shitty as Javascri…

Closures + Lexical Scoping + Prototypical Inheritance makes for a pretty great language IMHO.

Re: Apple's new Objective-C to Javascript Bridge

#32
post #26

> The most interesting possiblility would be that this is the start of Apple’s evolution away from Objective-C into promoting a higher-level language for their platform The thing is: Why would they want to transform away? As it is now Obj-C is pretty sane. The memory management is now a non-brainer so that even people who come from managed languages can grasp it. GCD is great for concurrency. And using C and C++ base…

Maybe I've just swallowed the Kool-Aid, but I don't see the putative benefits of Apple's switching platforms. I'm also not clear on how many people there are who a) can write non-trivial software and b) can't learn a C derivative language who c) would actually write software for Apple's platforms. It just seems like a pretty small set. And, if Apple were to switch, why would they pick a language as shitty as Javascri…

I actually like Javascript. Sure it has some warts. But it has an elegance I've really only seen in Javascript, Lua, and Lisp.

Re: Apple's new Objective-C to Javascript Bridge

#33
post #2

My guess is that this would be fast enough to build almost any Mac app and many iOS apps. The bigger question for me is, how gross would it be to deal with the "Objective-C-ness" of the Cocoa APIs through JavaScript?

That depends on the state of the bridge. Previous language bridges by Apple have generally bridged the gaps pretty well, with the main "Objective-C" relic being really, really long method names. That said, all of the bridges I've seen were to classical-OO languages. It is possible that Cocoa won't translate as well to prototypal-OO languages like JavaScript. It will be interesting to see how Apple navigates that para…

> all of the bridges I've seen were to classical-OO languages. It is possible that Cocoa won't translate as well to prototypal-OO languages like JavaScript.

This has already been done with Mozilla's Rhino (JavaScript or Java) and it turns out the be pretty easy to work with Java classes in that context.

Re: Apple's new Objective-C to Javascript Bridge

#35
post #32
post #26

Earlier quoted context omitted.

Maybe I've just swallowed the Kool-Aid, but I don't see the putative benefits of Apple's switching platforms. I'm also not clear on how many people there are who a) can write non-trivial software and b) can't learn a C derivative language who c) would actually write software for Apple's platforms. It just seems like a pretty small set. And, if Apple were to switch, why would they pick a language as shitty as Javascri…

I actually like Javascript. Sure it has some warts. But it has an elegance I've really only seen in Javascript, Lua, and Lisp.

You last sentence is a bit far-fetched.

Re: Apple's new Objective-C to Javascript Bridge

#38
This just seems like an evolution of the existing Obj-C/JS bridge (namely, WebScriptObject https://developer.apple.com/library/mac/#documentation/Cocoa... and WebScripting protocol https://developer.apple.com/library/mac/#documentation/Cocoa... ).

The main (very welcome) advancement seems to be that they've pushed this capability down from WebKit into JSCore. Today you can basically already do everything that's being shown in OP I think, you just were required to create an invisible WebView to host your JavaScript environment. You can easily expose classes to WebKit/JSCore (using KVC), and interact with JS objects from ObjC, and arrays, strings, etc. are auto-converted. The WebKit requirement is pretty annoying though, and as V8 has shown us, having a drop dead simple way of throwing JS into an app has some huge benefits.

Re: Apple's new Objective-C to Javascript Bridge

#40
post #26

> The most interesting possiblility would be that this is the start of Apple’s evolution away from Objective-C into promoting a higher-level language for their platform The thing is: Why would they want to transform away? As it is now Obj-C is pretty sane. The memory management is now a non-brainer so that even people who come from managed languages can grasp it. GCD is great for concurrency. And using C and C++ base…

Maybe I've just swallowed the Kool-Aid, but I don't see the putative benefits of Apple's switching platforms. I'm also not clear on how many people there are who a) can write non-trivial software and b) can't learn a C derivative language who c) would actually write software for Apple's platforms. It just seems like a pretty small set. And, if Apple were to switch, why would they pick a language as shitty as Javascri…

Wait, don't you remember Steve's original announcement about the great development opportunities on iPhone, where you could use HTML and Javascript?

You won't be able to use undocumented APIs because you won't be able to get to them.

Post reply on HN