Arc Forumnew | comments | leaders | submitlogin
4 points by rocketnia 2487 days ago | link | parent

I've taken the liberty of implementing a LavaScript REPL-on-the-web for you, similar to your Try Arc[1]. :) Your code seems to target server-side JavaScript, but I rigged it up to work on the client side anyway.

I hotlink to everything just so that I can keep it down to one file; as a side effect, if you push a new lava.js (not lava.coffee) to GitHub, it'll automatically use the new one.

There are a few nifty REPL variables. The variable "thatexpr" refers to the previous compiled command string. The variables "that" and "thaterror" refer to the most recent normal result and the most recent exception respectively. Would "thatunparsedexpr" and "thatparsedexpr" be worthwhile additions to this?

I see no way to hack in a stdin or stdout, or to fix the copy-and-paste issue, thanks to the way jQuery-console works. Now I understand why Try Arc has that trouble. ^_^;

https://gist.github.com/837840

http://rocketnia.kodingen.com/af/try-lava-script/

[1] http://tryarc.org/



1 point by rocketnia 2486 days ago | link

Oops! I posted that Gist as Anonymous. XD I've reposted it now under my own username: https://gist.github.com/840809

-----

2 points by evanrmurphy 2486 days ago | link

Updated the link in LavaScript's readme. :)

-----

1 point by rocketnia 2486 days ago | link

Thanks much. XD

-----

1 point by evanrmurphy 2487 days ago | link

Wow, thank you so much!! This is great! I've linked to it in the README: https://github.com/evanrmurphy/lava-script/blob/9ee2b4552ff8... :D

'that' and 'thatexpr' are both great! I should include those in the command-line REPL! :)

-----

1 point by evanrmurphy 2487 days ago | link

Nice choice of background color, by the way. Very lava-like. ^_^

-----

1 point by rocketnia 2486 days ago | link

It was surprisingly easy to make it any of several variants of a fruity pink-and-orange, an antique brown, or a garish red. Finally I came upon something that at least looked like it was supposed to look like lava, and yay, you noticed. XD

Come to think of it, subtle gradients might help to evoke more glowiness and dimensionality.

-----

1 point by evanrmurphy 2486 days ago | link

I wondered the same thing about gradients. ^_^ Maybe as a future refinement. :)

A couple of other things:

1. I like that you made it full screen.

2. I was pleasantly surprised you kept the same REPL pattern!

  > [input]
  [compiled]
  => [evaluated]
I tried several variations and found this to be most intuitive and readable. One thing I was on the fence about was using '>' for the input prompt instead of 'lava>'. The former just felt less cluttered to me.

-----

1 point by rocketnia 2486 days ago | link

1. I like that you made it full screen.

That part took a bunch of fiddling! XD I tried to use it on some Android browsers though, and it's not so friendly there.... Using an online REPL from a mobile device would be pretty nifty. ^_^

Hmm, jQuery-console's manual keypress checking makes it especially Android-unfriendly. A slide-out keyboard technically works, but I'd be lost without it. :/

2. I was pleasantly surprised you kept the same REPL pattern!

My original intent was to hack your REPL to work with the console. Actually, my original intent was to have an input box with "compile" and "now evaluate that" buttons, but I liked your REPL much better. :-p

One thing I was on the fence about was using '>' for the input prompt instead of 'lava>'. The former just felt less cluttered to me.

I think "lava>" would make more sense if it were possible to switch between REPLs, but ">" makes more sense now. :)

-----