Swank and the `app` context

6 views
Skip to first unread message

Matthew Snyder

unread,
Mar 21, 2011, 8:41:51 PM3/21/11
to Penumbra
Is there any way to have both a running app and a Swank REPL available
for manipulation? To wit:

user> (ns org.foo.baz
(:use [penumbra opengl])
(:require [penumbra.app :as app]
[penumbra.text :as text]
[penumbra.time :as time]
[penumbra.data :as data]))

org.foo.baz> (app/display-modes)
No implementation of method: :display-modes of protocol:
#'penumbra.app.window/Window found for class: nil
[Thrown class java.lang.IllegalArgumentException]

However, if I launch an app like so:

org.foo.baz> (defn key-press [key state]
(cond
(= key :escape) (app/stop!)
:else state))

org.foo.baz> (defn init [state]
(println app/display-modes))

org.foo.baz> (app/start {:key-press key-press :init init})

I can see the reference the display_modes return value printed:
#<app$display_modes penumbra.app$display_modes@5d3c19e3>

What I'd like to be able to do is inspect values and methods on app
with the REPL as I build the program. A lot of the allure of using a
REPL is lost if I have to continuously reset the app's state, test
something, and start it over again, and not be able to work with it
while it's running.

- Matthew
Reply all
Reply to author
Forward
0 new messages