Flapjax REPL

5 views
Skip to first unread message

Arjun Guha

unread,
Nov 2, 2009, 1:12:26 PM11/2/09
to Flapjax
Last week at OOPSLA, we live-coded a timer in Flapjax, using a custom
REPL. I've added this REPL to the demos on the Flapjax website:

http://www.flapjax-lang.org/demos/timer.html

See the popup in the bottom-right corner for the timer's code. Other
than the built-in timer UI and the showTime function, it is a generic
REPL. You can use it to play around with arbitrary expressions. So,
I've posted a version without the timer UI:

http://www.flapjax-lang.org/repl.html

This REPL is more interesting than it looks: you have access to
Flapjax's DOM constructors. Try entering these three lines:

elt = INPUT({ type: "button", value: "Click Me!" })
clicksE = $E(elt, "click")
clicksE.snapshotE(timerB(1000))

Two things to note:

1. You can break the REPL. It is not bulletproof. I've made an
attempt to isolate the REPL's code from the user's code. But, it's
still a hack that uses eval.

2. It doesn't work on IE at the moment. (Suggestions/patches
welcome.) I've tested it on Firefox and Safari.

Arjun

Fred Janon

unread,
Nov 3, 2009, 1:29:35 AM11/3/09
to fla...@googlegroups.com
Does the timer demo work in Windows FF3.0.15? It doesn't do anything, just shows an empty progress bar, a button and the solution in the lower corner. Nothing happens when click is pressed. I cannot enter any text in the solution window where the code is either.

The repl demo shows a blank page the body is empty.


Fred

Xingzhi Pan

unread,
Nov 3, 2009, 2:08:32 AM11/3/09
to fla...@googlegroups.com
At first it doesn't work on my Linux Firefox 3.5 either, but after I
opened Firebug's console (and clicked here and there) I was able to
input...weird.

Pan, Xingzhi

Arjun Guha

unread,
Nov 3, 2009, 8:38:56 AM11/3/09
to fla...@googlegroups.com
>
> At first it doesn't work on my Linux Firefox 3.5 either, but after I
> opened Firebug's console (and clicked here and there) I was able to
> input...weird.

This is weird. I'm careful to test with a version of Firefox that
does not have Firebug installed. I am working on a Mac, but that's
unlikely to be the issue.

(I just made a small change for Firefox: the empty prompt had zero
height--that is no longer the case.)

Arjun

Arjun Guha

unread,
Nov 3, 2009, 8:50:17 AM11/3/09
to fla...@googlegroups.com
> Does the timer demo work in Windows FF3.0.15? It doesn't do
> anything, just shows an empty progress bar, a button and the
> solution in the lower corner. Nothing happens when click is pressed.
> I cannot enter any text in the solution window where the code is
> either.
>
> The repl demo shows a blank page the body is empty.

I fixed this (tested on FF3.0.12 on a Mac).

I made some changes to Flapjax's DOM manipulation code that used
Element.children, which is only supported by IE8/Safari4/FF3.5. I've
reverted to using Element.childNodes, which works on older browsers.

In the future, I'll use older browsers while testing.

Arjun


Fred Janon

unread,
Nov 3, 2009, 9:12:18 AM11/3/09
to fla...@googlegroups.com
REPL works now on Windows FF 3.0.14. timer still doesn't do anything.

Fred

Arjun Guha

unread,
Nov 3, 2009, 9:36:40 AM11/3/09
to Flapjax
> REPL works now on Windows FF 3.0.14. timer still doesn't do anything.
>
> Fred

Could you be more specific? Here's what it's supposed to look like,
after you've typed in the solution:


http://www.cs.brown.edu/~arjun/tmp/timer.png

(The mouse image is a little jittery--don't know why).

Arjun

Fred Janon

unread,
Nov 3, 2009, 11:21:07 AM11/3/09
to fla...@googlegroups.com
Here is a screen shot on Windows FF 3.0.14. There is no area to input anything. The box with the solution is there though (not on the screen shot. I had no idea what it was supposed to do until I saw your screenshot.

Fred
flapjax.jpg

Arjun Guha

unread,
Nov 5, 2009, 4:30:01 PM11/5/09
to fla...@googlegroups.com
I just installed Firefox 3.0.15 on Windows XP. It's my first
installation, so no addons.

Both the timer and standalone REPL work fine. I doubt it's an issue
with a minor point release. (I can't seem to get Firefox 3.0.14 from mozilla.org
. I'm not getting it from 3rd-party sources since I don't run a virus
checker.)

I think the next step in debugging this is to give me the output from
your error console. Specifically:

1. Tools -> Error Console -> Clear
2. http://www.flapjax-lang.org/demos/timer.html
3. Tools -> Error Console , and then screenshot (apparently you can't
copy).

A Firebug log will do too.

Arjun






I can't figure out how to get FF 3.0.14
> <flapjax.jpg>

Fred Janon

unread,
Nov 6, 2009, 7:18:24 AM11/6/09
to fla...@googlegroups.com
REPL is working now. Cool. The script must have been cached by FF, sorry.

Fred
Reply all
Reply to author
Forward
0 new messages