News for hackers. Stuff that matters.
Re:IOS games using JavaScriptCore without WebKit by tlrobinson on Wednesday April 27, 2011 @02:00PM (#2490405)
AFAIK the only way Apple can enable Nitro for 3rd party apps without enabling executable memory pages generally is by separating JavaScriptCore (and WebKit render engine) into separate processes (ala WebKit2 / Chrome) which are allowed to create executable memory pages.

Then, of course, there is no way to create bindings between your code and the JavaScript interpreter (at least not without the overhead of IPC, which would probably negate any benefits of enabling Nitro).

So yeah, I wouldn't hold my breath.

Re:IOS games using JavaScriptCore without WebKit by jonbro on Wednesday April 27, 2011 @12:29PM (#2490031)
I am super glad he has released this. He is not joking about compiling javascript core for iOS being painful, I dumped many hours into it. It would have been nice of him to release the project files just for jsc under MIT or something, but I guess people have to make money somehow.
Re:IOS games using JavaScriptCore without WebKit by comex on Wednesday April 27, 2011 @07:02PM (#2491431)
Since JavaScriptCore is LGPL, you could probably demand them from him after buying some app that uses this.

"For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library."

Re:IOS games using JavaScriptCore without WebKit by phoboslab on Wednesday April 27, 2011 @08:08PM (#2491621)
So we could demand the project files to build it for iOS directly from Apple then? :)

Anyway, I will tidy up and release the project files and patches for JSC in a couple of days. My selling point is the game engine and the OpenGL Canvas abstraction, not JSC.

Re:IOS games using JavaScriptCore without WebKit by pluies_public on Thursday April 28, 2011 @05:24AM (#2492708)
> So we could demand the project files to build it for iOS directly from Apple then? :)

Yes?

http://opensource.apple.com/source/JavaScriptCore/JavaScript...

It's from iOS 4.2 (http://opensource.apple.com/release/ios-42/), as JSC's source in iOS 4.3 is marked as "coming soon" (http://opensource.apple.com/release/ios-43/).

Re:IOS games using JavaScriptCore without WebKit by gord on Wednesday April 27, 2011 @10:36PM (#2491874)
helpful, thanks.
Re:IOS games using JavaScriptCore without WebKit by tzm on Wednesday April 27, 2011 @04:03PM (#2490876)
Appcelerator's Titanium uses JavaScriptCore as well to create native bindings to UIKit. Titanium is not a UIWebView wrapper per se, although that is one of many UIViews you can create and embed web apps. The result is a much more "native" experience and tighter integration to platform capabilities.
Re:IOS games using JavaScriptCore without WebKit by richcollins on Wednesday April 27, 2011 @02:25PM (#2490505)
also see ngcore, a JavaScript gaming framework that uses OpenGL under the hood. It's maintained by ngmoco:)
Re:IOS games using JavaScriptCore without WebKit by tlrobinson on Wednesday April 27, 2011 @03:14PM (#2490684)
Re:IOS games using JavaScriptCore without WebKit by swix on Wednesday April 27, 2011 @02:42PM (#2490575)
This is commercial though right? I mean it's not open source that I can just dl an Xcode project and play around with, it's hosted by them or something like that?
Re:IOS games using JavaScriptCore without WebKit by phoboslab on Wednesday April 27, 2011 @07:31PM (#2491524)
It is commercial, but it is also open source. If you have a license for the game engine, you will get the whole source code for the project and can do whatever you want with it.
Re:IOS games using JavaScriptCore without WebKit by alanfalcon on Wednesday April 27, 2011 @05:53PM (#2491243)
> Which leaves me to wonder why the JavaScriptCore library that comes with iOS is private in the first place.

Because the JavaScriptCore library is not finalized? I don't understand what there is to wonder about. Other than that point, I still think this is really awesome.

Re:IOS games using JavaScriptCore without WebKit by phoboslab on Wednesday April 27, 2011 @08:15PM (#2491636)
The API for JSC has stayed unchanged for years. JSC is a public library on OSX and there are thousands of Apps that rely on it.

The only reason it's not public on iOS is that Apple doesn't like scripting languages on a mobile device, as they are potentially slow and energy hungry. At least that's my guess.

Re:IOS games using JavaScriptCore without WebKit by pygy_ on Thursday April 28, 2011 @03:45AM (#2492539)
However, it's possible to compile and use JSC as an interpreter, which is Even slower.

They won't let you use the private dynamic compiler, though, most probably for se urity reasons.

Re:IOS games using JavaScriptCore without WebKit by chc on Wednesday April 27, 2011 @06:26PM (#2491343)
What on earth does that mean, "not finalized"? How is JavaScriptCore on iOS less "finalized" than the same library on every other platform?
Re:IOS games using JavaScriptCore without WebKit by efnx on Wednesday April 27, 2011 @01:20PM (#2490252)
I'm hoping he releases a guide (or at least the project files) for bundling JSC.
Re:IOS games using JavaScriptCore without WebKit by NSMeta on Wednesday April 27, 2011 @04:08PM (#2490893)
Correct me if I'm wrong: Titanium compiles to Objective-C.

This is, of course, different since it runs actual JavaScript code. Does Apple prohibit use of Titanium? Sorry I wasn't following this for some time.

Re:IOS games using JavaScriptCore without WebKit by tzm on Thursday April 28, 2011 @12:33PM (#2493963)
Titanium uses JavaScriptCore as a runtime interpreter to bind to native Obj-C, which is in full compliance with Apple's policies regarding interpreted code (section 3.3.2).
Re:IOS games using JavaScriptCore without WebKit by zbowling on Wednesday April 27, 2011 @01:11PM (#2490201)
Neat.

...but it's still violating the iOS developer agreement. Specifically the no interpreter rule except those provided by Apple. They probably didn't notice but blogging about it may get the apps pulled.

Take it from someone that has been on Apple's bad side: this is a bad idea and will probably get you pulled. They also don't like braggers that figured out ways around the rules.

I've dealt with these things. There are few options though. Compiling to native (in a AOT style) is one way, (ala MonoTouch and Adobe's Flash Convert tools). The other is just embedding a UIWebView somewhere (even if it's not visible) and IPCing over stringByEvaluatingJavaScriptFromString and URL change notifications.

Re:IOS games using JavaScriptCore without WebKit by chc on Wednesday April 27, 2011 @01:15PM (#2490220)
The rule you reference no longer exists. You can run an interpreter as long as the code you're going to interpret is part of the app you submitted for review (i.e. you aren't allowed to use JavaScriptCore to run scripts off a web page, but your app can use any kind of interpreter it wants internally). The rule was horribly misguided and never really enforced — many of the top apps have always embedded scripting languages.
Re:IOS games using JavaScriptCore without WebKit by zbowling on Wednesday April 27, 2011 @01:29PM (#2490286)
Interesting... You're correct. I wonder when that changed. THIS CHANGES EVERYTHING

  3.3.2 An Application may not download or install 
  executable code. Interpreted code may only be used 
  in an Application if all scripts, code and interpreters
  are packaged in the Application and not downloaded. The 
  only exception to the foregoing is scripts and code 
  downloaded and run by Apple's built-in WebKit framework.
The rule was however enforced. My own app was pulled for it a year ago for embedding an little tiny Lua interpreter for handling a few game logic changes.

The question is still interpreted code that is not included with the app but written by the user in the app. I used to work for TI programming graphing calculators a couple jobs back. I always wondered if we could do a port of one of the later generation calculators to iPhone but I always stopped at TI-Basic or if our CAS engine could be considered an interpretor. Now given the rule change, would user entered code still be considered against the rules. It wouldn't be code shipped with the app... but still.

Re:IOS games using JavaScriptCore without WebKit by chc on Wednesday April 27, 2011 @01:55PM (#2490385)
Code written by the user is still forbidden, though Apple are really sketchy as to what they consider "external interpreted code" versus just "a document." To a large degree, it seems like a question of marketing. If the feature feels like writing a program, the reviewers will reject it. I am not sure how sophisticated the calculator you're thinking of is. It's possible Apple could see it as just storing formulae, which they'd be OK with. Tough to say.

(And for anyone who thinks I'm splitting hairs: The line between "document" and "program" really is fuzzy. For example, Little Big Planet's game engine turns out to be Turing-complete, so you can build a working computer in the level editor out of game objects. See here for more: http://forums.xkcd.com/viewtopic.php?f=12&t=57034 )

Re:IOS games using JavaScriptCore without WebKit by comex on Wednesday April 27, 2011 @07:04PM (#2491437)
No, it's not. iScheme is in the store and its only purpose is to evaluate code entered by the user. (http://itunes.apple.com/us/app/ischeme/id395305584?mt=8)
Re:IOS games using JavaScriptCore without WebKit by nickmain on Wednesday April 27, 2011 @07:39PM (#2491549)
Also Pixie Scheme ( http://web.mac.com/Jay_Reynolds_Freeman/My/Pixie_Scheme_III.... ) - which has the notion of a persistent "world", but does not allow code to be loaded from external files.
Re:IOS games using JavaScriptCore without WebKit by chc on Wednesday April 27, 2011 @07:58PM (#2491596)
That's very odd. I was sure I remembered somebody getting rejected very recently for running code written by the user. I must have been dreaming. Thanks for the correction.
Re:IOS games using JavaScriptCore without WebKit by Locke1689 on Wednesday April 27, 2011 @04:40PM (#2491020)
iOS[1] is Apple's mobile operating system. IOS is Cisco's Internetworking Operating System[2]

[1] http://en.wikipedia.org/wiki/IOS_(Apple)

[2] http://en.wikipedia.org/wiki/Cisco_IOS

Re:IOS games using JavaScriptCore without WebKit by wahnfrieden on Wednesday April 27, 2011 @04:46PM (#2491042)
HN autocapitalizes the first letter of submissions. So it's most likely not the submitter's mistake.
Re:IOS games using JavaScriptCore without WebKit by Locke1689 on Wednesday April 27, 2011 @08:03PM (#2491608)
Huh, didn't know that, thanks.