iPhone and Gambit Scheme
James Long has written some awesome stuff allowing you to code iPhone applications with Gambit Scheme. I will leave the details for james to explain, which he does excellently here.
However… the Xcode project as downloaded does not work, the first gotcha was explained to me by James after I mailed him a sorry tale of hours spent poring over assembly code and some hair-pulling by me.
The fix is incredibly simple and I will simply put the email response from James here so you can see the fix:
I know exactly what it is, and I am so sorry you spent so much time trying to figure it out. If you look in lib/init.scm, at the top you'll see a section for "debugger". I think this should be the code:
(include "util/remote-debugger/debuggee.scm") (rdi-set-host! "localhost:20000") (thread-start! (make-thread (lambda () (##repl-debug-main))))
Comment out all of these lines, and it should work. The problem is that you aren't running the debugger for the app to connect to, and the debugging libraries for this are extremely rough, and don't even handle the case where there isn't a debugger to connect to. It's partially my fault for not noting this somewhere. It comes from the call to `___setup` because that's where Gambit evaluates all of the code at the top level, and that code is executed immediately. I am sorry again you had to spend so much time on it. I'm currently reworking my site and am hoping to write more articles about using Gambit on the iPhone and will update everything to make it better. Let me know if that works! - James
That was a great help but there is one more file that needs to be changed, it is the lib/config.scm file, and you need to change it to whatever path is appropriate for your system, this is what it contains as downloaded :-
(load "/Users/james/projects/scheme/gambit-iphone-example/lib/apps/app5")
Once you do that, you can build and run and it just works as expected.
I want to say a big thanks to James for responding so quickly and with accurate information to boot. I shall be in the corner coding scheme on my iPhone if anybody wants me…