Live data from Hacker News

Apple's new Objective-C to Javascript Bridge

steamclock.com

101–110 of 110 posts

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

#101

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

> Why JavaScript? Because websites (and thus JavaScript, in some form) are the future of programming at this point in time. JavaScript just happens to be the primary programming language for interacting with HTML5 and a lot of people happen to know it pretty well. Plus, JavaScript is not a terrible language but it does take a lot of knowledge to work with it cross-browser and use browser APIs (these browser APIs tend…

JavaScript is not the future of programming. It is the past, present, and (most likely) future of client-side web programming, but that's all.

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

#102
Every HN post that happens to mention Javascript:

     "Javascript is so shitty though!"

     "I agree!"

     "Javascript isn't so shitty once you get used to it"

     "It's like lisp!"

     "No it isn't. Javascript is terrible and everyone who likes it is a moron"

     "No they aren't!"

     "YES THEY ARE"

I don't know, should we expect more from the discourse here than just rehashing the same argument over and over again?

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

#103
post #76
post #73

Earlier quoted context omitted.

As I recall, BridgeSupport created indexes to C symbols, enumerations and functions by producing XML files [1] that corresponded to C APIs like CoreGraphics, and code you produced yourself. You don't necessarily need BridgeSupport to call out to Objective-C. Speaking of BridgeSupport, does anybody know where the most recent source code for that project went? It seems to have been removed from Apple's Mac OS Forge aft…

BridgeSupport also supplies .dylibs containing inline functions/macros that don't have symbols/linkage in the main framework. While it is possible to workaround the lack of BridgeSupport, if Apple doesn't supply it, most developers are not going to go through the effort of using it. And if Apple doesn't supply it on iOS, they aren't going to make life nice for developers doing this (continue bans on dynamic libraries…

You may be in luck, sir or ma'am. It looks like the one man army behind Mobiruby found a copy;

https://github.com/mobiruby/BridgeSupport

Which he found from a really neat looking archive for popular open source projects, at that. Bookmarking.

http://code.metager.de/source/

Just made a few fixes to get the BridgeSupport framework to compile on 10.8. Might issue a pull request.

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

#104
post #83

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…

Totally agree it's more like an evolution, and I doubt it will be exposed on iOS at all, which means the same developer rules will apply and downloaded JS will have to be running inside a UIWebView. The fact is that after thinking about the iOS developer rules and what is currently available in iOS, it's totally doable to write a true Javascript bridge that respect all the requirement from the iOS rules and still let…

I accepted a pod to cocoapods recently that does most of what you're after: https://github.com/marcuswestin/WebViewJavascriptBridge

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

#105
post #94
post #32

Earlier quoted context omitted.

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

If Javascript had a saner type system, better scoping, and a decent module system, it would easily be the best language out there. Right now, it is a diamond covered in loads of poop. I still haven't found a language that implements events as elegantly as Javascript.

Some of those things are improving in ES6 with block scoping and modules.

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

#106
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…

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

ObjC has closures (blocks) and ObjC runtime (but not the syntax!) supports prototypical inheritance.

Actually the ObjC runtime is amazingly powerful and dynamic, as if it was made for a better language (e.g. can handle dynamism of Ruby http://macruby.org/)

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

#107
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…

>And, if Apple were to switch, why would they pick a language as shitty as Javascript?

That seems to be a fairly popular dismissal for a language designed in 10 days, and perhaps rightly so. JavaScript probably classifies as mediocre language compared to the wealth of sanely designed choices we have available today.

That said, have you taken a recent look at the next generation of JavaScript aka ES6/Harmony?[1]

- Modules? Yup

- Maps and Sets? You bet.

- Tail call optimizations? Sure

- Classes? Finally!

etc

That's not to suggest that a single iteration will magically fix all of its quirks and shortcomings. However, one possibility could be that Apple picked JS, not on it's checkered history, or the fact that it is popular amongst web developers today, but where it is headed tomorrow and how it could be adopted and adapted.

[1] https://wiki.mozilla.org/ES6_plans*

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

#108
post #81

Earlier quoted context omitted.

And the global object nonsense alone is enough to make it suck. Throw in the lack of an integer type, the curious `for each' statement, and the oddities surrounding `this', and it really starts to feel like this is the sort of language that over time is going to cause you a lot of heartache. It makes me sad - seriously, do people not expect better from their tools? The maddening thing is that Javascript could so easi…

I was under the impression that javascript's strict mode already does this?

Yes, it looks like it does. And browser support looks decent enough. Thanks!

I don't recall seeing this mentioned anywhere. Perhaps the still-imperfect browser support puts people off.

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

#109
post #78

I never had a big problem with Obj-C. It felt like any other language other than having to manually manage memory. The problem I struggled with was Cocoa as a whole. It may no longer be the case but not too long ago, there was a lack of consistency between the different APIs / SDKs. Most would written and accessed with Obj-C. A few would still be in Ansi-C. For someone who isn't a C expert, this just killed me. Does…

Yeah, like the iOS contacts API. I really like Objective C. (I better since I write it full time, lol)

Geez that's still a problem? They really need to change that.

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

#110

Earlier quoted context omitted.

> Why JavaScript? Because websites (and thus JavaScript, in some form) are the future of programming at this point in time. JavaScript just happens to be the primary programming language for interacting with HTML5 and a lot of people happen to know it pretty well. Plus, JavaScript is not a terrible language but it does take a lot of knowledge to work with it cross-browser and use browser APIs (these browser APIs tend…

JavaScript is not the future of programming. It is the past, present, and (most likely) future of client-side web programming, but that's all.

I don't know why I bother to post on HN... I said websites are the future of programming. So yes, JavaScript is the client-side portion of that in which I was referring to in my previous post that you had to retort in some manner. Of course, you can use JavaScript, Ruby, Python, PHP for the server-side, but regardless that is a moot point when the article is about client-side programming on OS X.
Post reply on HN