On 2011-06-16, at 3:18 PM, Raffael Cavallaro wrote:
On Jun 16, 2011, at 9:07 AM, Marc Feeley wrote:
My next experiment is to add to Gambit REPL a way to share code with other users on a public repository directly from the iPhone/iPad (currently it is possible to download code by telneting to the device, but I'm aiming at something more user friendly). If you have ideas (or even better, code) please let me know.
Interesting experiment. I suppose you know that the whole "download and interpret" thing is forbidden:
"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."
from the June 2011 agreement posted online here (scroll down to section 3.2.2): http://www.lagbaja.org/2011/06/ios-developer-program-license-agreement.html
One possible technically permissible workaround would be as follows, remembering that any downloaded code must be downloaded and *run* by WebKit (i.e., javascript):
- An in-app action to "share script" would translate the scheme into some simple javascript equivalent, say a javascript s-expression class.
- A small bit of *javascript* in the gambit REPL app would push this javascript translation to the repository. Use javascript for the upload as well so that all network interaction takes place via WebKit.
- The repository server would translate it back to scheme *only for display purposes* on the depository website/wiki, but the only thing that would ever go over the network is the javascript version.
- An in-app action to "download script" would use *javscript* to request the script (which is displayed on the repository website as scheme, and therefore displayed in-app using an iOS UIWebView as scheme, but is actually transmitted over the network as *javascript*) and download the javascript translation to the iOS device.
- Some *javascript* in the gambit REPL app would run it. Running it would consist of executing a simple function in javascript that translates the naive javascript representation of scheme code into scheme readable by gambit, and passing it off to gambit.
warmest regards,
That's a neat hack. Basically, you encode the Scheme code as a JavaScript program which, when run, produces the Scheme code which will be handed to Gambit. Hmmm... Are there any lawyers on this list who would like to comment?
Marc