Live data from Hacker News

Try Python, Ruby, Lua, Scheme, QBasic, Forth ...

repl.it

41–50 of 81 posts

Re: Try Python, Ruby, Lua, Scheme, QBasic, Forth ...

#41
post #36
post #35

Earlier quoted context omitted.

It's not really discussed in the PEP but in fact python treats the tab at the same indentation level as 8 spaces. You can mix tabs and 8 spaces without impunity Check http://ideone.com/VIwf4 for an example. Basically, it shows that python treats 8 spaces at the same indent level as a tab

I think ideone and/or your editor converts tabs to 8 spaces. Trying a tab indent followed by an 8-space one raises an error in native IPython for me. In any case, we're using normal CPython compiled to JavaScript, so it's unlikely to change finer points of the behaviour like this.

in CPython (at least, on my mac) mixing tabs and 8 spaces works perfectly fine. try it out!

Re: Try Python, Ruby, Lua, Scheme, QBasic, Forth ...

#42
post #40

Why isn't the print function working in Qbasic? What restrictions are there in the compiler?

You might be hitting the fact that QBasic actually requires keywords to be in capitals. The original IDE did the conversion for you, but repl.it doesn't. We should really be more lenient about those. For now, check the existing examples and use your trusty caps lock.

Re: Try Python, Ruby, Lua, Scheme, QBasic, Forth ...

#43
post #42
post #40

Why isn't the print function working in Qbasic? What restrictions are there in the compiler?

You might be hitting the fact that QBasic actually requires keywords to be in capitals. The original IDE did the conversion for you, but repl.it doesn't. We should really be more lenient about those. For now, check the existing examples and use your trusty caps lock.

The actual QuickBASIC compiler allowed any case for keywords.

The lack of line numbers was a bit confusing too - my first inclination when seeing a BASIC prompt is to type

  10 PRINT "hello"
  20 GOTO 10
Aside from that, it seems to work as expected (at least in the quick tests I tried).

Re: Try Python, Ruby, Lua, Scheme, QBasic, Forth ...

#44

Doesn't work too well with my Swedish keyboard layout. If I want to use "[" or "]" I'd normally use Alt Gr+8 or Alt Gr+9, that doesn't work. This makes it almost impossible to code.

Thanks for the report. We're handling input as raw keystrokes for flexibility, so the more advanced features are sometimes not supported. I've opened an issue for it (https://github.com/replit/jq-console/issues/19) in the appropriate repository. Feel free to watch that for updates.

Re: Try Python, Ruby, Lua, Scheme, QBasic, Forth ...

#47
Oops:

  > import subprocess
  Traceback (most recent call last):
    File "", line 1, in 
    File "/lib/python2.7/subprocess.py", line 429, in 
      import select
  ImportError: No module named select

Also:

  > os.name
  => 'posix'
  > os.uname()
  => ('Emscripten', 'emscripten', '1.0', '#1', 'x86-JS')
  > os.environ
  => {'LANG': 'en_US.UTF-8', 'PYTHONHOME': '/:/', 'PWD': '/',
  'USER': 'root', 'HOME': '/', 'PATH': '/', '_': './this.program'}
  > os.getcwd()
  => '/sandbox'
  > os.chdir('/')
  > os.getcwd()
  => '/'
  > os.popen2('ls -l')
  Traceback (most recent call last):
    File "", line 1, in 
    File "/lib/python2.7/os.py", line 667, in popen2
      import subprocess
    File "/lib/python2.7/subprocess.py", line 429, in 
      import select
  ImportError: No module named select
  > os.popen('ls -l')
  Traceback (most recent call last):
    File "", line 1, in 
  OSError: [Errno 24] Too many open files
* I liked the 'x86-JS' as the architecture.

* I know about os.listdir() but I wanted the permissions.

* I automatically did a ^W to delete a word and closed the tab. I don't feel like opening it again or I would probably have more.

* I realize that since this is a CPython -> JS converter that the REPL is running in my browser and no on a server (AFAIK) so it's not like this attempting to hack someone's server, but I found it interesting to probe the environment.

Re: Try Python, Ruby, Lua, Scheme, QBasic, Forth ...

#48

I wonder whether Haskell is on their todo list. GHC's LLVM backend [1] might be helpful. [1] http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler...

I've spoken a little about the reason we couldn't use GHC among other things, at https://github.com/replit/repl.it/issues/43. In short, we need an interpreter rather than a compiler or a JIT, and we need the interpreter itself to run in the browser.

Re: Try Python, Ruby, Lua, Scheme, QBasic, Forth ...

#50
post #2

amasad: After a 5 minute play my first impressions are 'awesome!'. Some feedback: I selected QBasic then changed my mind but couldn't immediately figure out how to get back to the list of the languages. Clicking the logo of a website usually takes you back to the 'home page', which in this case I consider to be the list of languages. You have buttons at the top right, with the lambda taking me back to the language ch…

I liked the fact that it is much faster than ideone[1], even though it has way less languages. [1] http://ideone.com/

I think the difference is that ideone is actually running those languages on the backend, whereas this is running JS-based interpreters in the browser.
Post reply on HN