Wednesday, October 01, 2014

Gotcha of the Day: Gambit Scheme App's Script Panel is Blank

I kept running into this odd issue with the Gambit for Android app. When I first kicked off the app I got this nice splash screen:

I could then switch to the Scripts section to see various examples. I then added my own lex helper function. After adding it, I'm able to switch back to the REPL and see that it works:

So far, so good. When I'd kick off Gambit again, I'd be taken right to a basic REPL screen. But when I used the menus to switch to the Scripts section I was consistently taken to a blank screen:

What the heck? Where'd the scripts go?

I let the app just sit for a while - maybe it was hung on something. Then I forced it to stop and restarted it. Again, still blank. Then I rebooted the phone. Again, still blank. Finally, I uninstalled and re-installed the app. That fixed the problem. That is, until the problem popped back up again. Again, what the heck?

As a work around, I found that if I cleared the app's data I'd effectively reset the app back to the starting start; the splash screen appears, but my custom script is gone.

Surely there had to be a better way.

Then I took a closer look at the sample scripts. I noticed that the 'main' script is as follows:

;; Main script.
;;
;; Start with splash screen.

(splash)

I switched to the REPL and entered the code (splash). What do you know, the splash screen appeared!

Looking closer at the sample scripts I also noticed calls to (repl) and (edit). Invoking these functions switch you to the REPL and to the script editing screen respectively.

I think I get what the app is doing. I told it to run my little script. And it's doing exactly that. I'm not setting up the edit screen, so switching to the edit panel in the menu system isn't working. I think that's probably a bug in the app, but a fairly minor one. For one, I can switch to the edit screen anytime I want by invoking (edit) and for another, if I update my script to read:

(define (lex)
  (load "/sdcard/Documents/ex1.scm"))

(edit) ; ****

Then every time Gambit starts, it begins in the edit Scripts instead of a plain o' REPL. At the end of the day, I need to give the Gambit App more credit, it's actually doing something pretty slick.

No comments:

Post a Comment