Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Breaking Up with Google Play: Why Conversations Is Now Free (gultsch.de)
    185comments
  2. PipePipe: NewPipe hard fork implementing SponsorBlock (github.com/infinityloop1308)
    43comments
  3. Fifteen years later, the Apple Cards origin story (lexontech.org)
    39comments
  4. The Lost Atomic Update on Loongson CPU (jia.je)
    —discuss
  5. Show HN: A Claude Code skill to analyze your chess games (github.com/brumar)
    18comments
  6. Modern Object Pascal Introduction for Programmers – Castle Game Engine (castle-engine.io)
    29comments
  7. Revealing the details of how OpenAI agents hacked Hugging Face (swarmtraces.org)
    398comments
  8. Reflections on 1,000 Days of Math (gmays.com)
    8comments
  9. I'm the Mom in That Viral Giants Clip. Let Me Tell You About My Husband (themomoftheyear.substack.com)
    17comments
  10. Analyzing Frontier Model Progress with My Favourite Game: Prince of Persia (blog.priyan.in)
    18comments
  11. We're gonna need a lot more mathematicians (terrytao.wordpress.com)
    367comments
  12. Plan mode is dead (aymannadeem.com)
    426comments
  13. Floci: Locally emulating any cloud service (floci.io)
    22comments
  14. Make Claude your assistant in excalidraw (tangled.org)
    2comments
  15. Ollaya – Ollama for open-source, Jev-style decision models (ollaya.dev)
    134comments
  16. Banks and Credit Unions to Team Up Against Apple Pay Fees (macrumors.com)
    2comments
  17. Is your Postgres migration safe or not safe? (safenotsafe.dev)
    31comments
  18. New Satellite Engine Could Use Earth's Atmosphere to Stay in Orbit Indefinitely (scitechdaily.com)
    2comments
  19. 16GB iPod Nano 3G Upgrade (tuckerosman.com)
    12comments
  20. Parsing Expression Grammar vs. Regexes: Building Org Parser in Lisp, Export HTML (jointhefreeworld.org)
    14comments
  21. Show HN: Jev Plays Pokémon Red (jev-pokemon.vercel.app)
    94comments
  22. A single function Jev-like wrapper for LLMs, including vision models (allanrbo.blogspot.com)
    38comments
  23. What even is an OS now? (sockpuppet.org)
    381comments
  24. Calculating atmospheric drag on satellites for a Cubesat [pdf] (osti.gov)
    7comments
  25. Ask HN: Who's still keeping a DOS machine up because the business depends on it?
    212comments
  26. Gravity seems holographic. What does that mean for reality? (quantamagazine.org)
    197comments
  27. Plunging test scores are a slow-moving catastrophe (economist.com)
    123comments
  28. The Murky History of Soviet-Born Tetris (mitpress.mit.edu)
    18comments
  29. Scientists build most accurate atomic clock (phys.org)
    23comments
  30. Jury finds Facebook liable for deceiving users in Cambridge Analytica case (cbsnews.com)
    94comments

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

390 pointsby 15y agorepl.it
78 comments
Everything is open source at http://github.com/replit/
15y agoHN ↗

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 chooser. Maybe button labels, even tooltips would help. But I would definitely make the logo the 'home' button. Even refreshing the page didn't take me back.

Anyway, a minor complaint. A super-cool effort. I will now go play with it some more.

15y agoHN ↗

We thought the lambda button would be obvious! Will add labels/tooltips soon, thanks.

15y agoHN ↗

It wasn't obvious enough for a half-asleep half-wit (me). But as I said, a very minor complaint. It is a great app you have made.

15y agoHN ↗

I thought that the lambda button would give me a list of available functions in my current language. I'd definitely recommend changing the label to something less ambiguous.

15y agoHN ↗

Same comment as the GP. I felt like you're breaking a convention by not having the logo go back to the chooser page, and by not returning to the chooser on refresh/revisit.

15y agoHN ↗

Website conventions? We think of repl.it as a webapp, not a website. Once you load a language the app remembers your language and loads it for you on next page load, and if you want to change your language you click the language selector button (which I agree is not that clear at the moment).

15y agoHN ↗

Then it should also load the last program you were working on -- and, if possible, the output from the interpreter as well.

Cool app!

15y agoHN ↗

Currently you can save a replayable session and get a unique link, but this is public. We do have plans to remember history locally (either just as command history or a full-blown session) in the future. The initial relevant issue is at https://github.com/replit/repl.it/issues/15.

15y agoHN ↗

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.

15y agoHN ↗

A quick fix has been deployed. Clicking on the logo would open up the language selector page, and added tooltips to the buttons.

15y agoHN ↗

It's fun by itself, but what I believe could make it really useful would be to include interactive tutorials for each language. That's what I was expecting when I clicked the link.

15y agoHN ↗

We have put lots of time and effort into getting all of these languages to run smoothly in the browser, we thought we would showcase this project before continuing on with our plans (more languages, tutorials, etc..).

15y agoHN ↗

Sorry I realize my comment sounded a bit negative, which wasn't at all my intention. You've done a fantastic job already and it's great to know tutorials are on your todo list.

15y agoHN ↗

Hitting that QBasic button was like Hot Tub Time Machine... and just as bad as the movie.

15y agoHN ↗

Awesome work guys! Keep at it and I would love to play around with tutorials in the future.

15y agoHN ↗

Thanks, we'll keep you posted for new features.

15y agoHN ↗

Would it be possible to implement user input via the REPL instead of the current javascript prompts? Would be much less clunky.

Also, at the moment something like this doesn't work at all (Python):

  while True:
      user_input = raw_input()
      if user_input is 'q':
          break
      else:
          print user_input
15y agoHN ↗

This problem happens with Python/Lua/Ruby because they're compiled from their original lower-level implementations using Emscripten. Which means everything have to work synchronously and there is no way to stop execution in order to get the user's input, unless we transform the code into CPS, which will probably make it much slower.

15y agoHN ↗

I'm unsure about the Scheme that is included. It claims to be R6RS which requires support for exact numerical operations including big integers and rationals. Currently it seems to use only double precision floating point instead of exact integer values!

15y agoHN ↗

This is awesome! I see this replacing my normal pastebin/ideone workflows ...

One comment: in python, technically tabs are equivalent to 8 spaces, but in your REPL it is equivalent to 4 spaces. Is that a modification to the version of python you are using, or did you make a decision to match 4 spaces (BTW: I really like this, but it breaks some older code)

15y agoHN ↗

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

15y agoHN ↗

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.

15y agoHN ↗

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

15y agoHN ↗

I am amazed, more so by the fact that you made the source code available (and also since it's made with node.js).

I will have a lot of fun either with the app itself or the source code. Thanks!

15y agoHN ↗

Everything happens on client-side the server is just for saving sessions and file serving. So technically its not written in node.js. Node is only a dependency for the development tools we use (coffee-script, mini-server for development). However the server running repl.it is written in Node, its nothing fancy but it makes us run cheap and it will be open-sourced soon.

15y agoHN ↗

Nice stuff... What about some SCALA ? mixed paradigm functional + object oriented with a lot of mojo !

15y agoHN ↗

Scala is great and we would love to have it. But the core philosophy behind repl.it is that everything has to be client-side. We're not very experienced with the JVM languages, but we are planning to experiment in loading them inside a Java Applet. Not sure how doable is this, would appreciate some feedback.

15y agoHN ↗

Nice, thanks for the reply... I am not sure either if it can be done like that, but It would be great to have it. Good luck with the experiment I hope it works out well.

15y agoHN ↗

ClojureScript is compiled to JS using Clojure which needs the JVM to run.

15y agoHN ↗

Great site. A trivial gripe: you should get rid of the text shadow on the "Select a Language" title. Grey CSS text shadows on grey backgrounds tend to look blurry, and this is no exception. Or, better yet, make it a white 1px shadow with no blur: http://goo.gl/BU0Hu

15y agoHN ↗

I'm getting a 330 ERR_CONTENT_DECODING_FAILED when I try to load up the site. If no one else is getting this then chances are it's my company's firewall interfering. If its rule set detects either "fun" and/or "potentially useful" the site is immediately banned.

15y agoHN ↗

Getting the same error here.

Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error.

15y agoHN ↗

Is this chrome? Did you try it on other browsers?

15y agoHN ↗

Chrome 14.0.835.186 m Windows 7, I get the above error.

Firefox 6.02 I get:

The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.

15y agoHN ↗

same error here as well, also behind a corporate firewall, it's usually fairly well behaved but if it doesn't understand something it's sometimes prone to petulance.

15y agoHN ↗

Scheme runs nicely on an iPhone 3GS. The Emscripten-compiled stuff crashes before you get to a prompt. Still, good stuff!

EDIT: I take that back. Lua runs, Python and Ruby do not.

15y agoHN ↗

Yeah we are working on that. We didn't have a physical iOS device and the simulator cheated us into thinking that it actually works!

15y agoHN ↗

Love it. This site is hella-fast and responsive compared to the other "Try [x]" web apps I've used before. Love the addition of LOLCODE. Personally, it took me a second to figure out the lambda and eg buttons, but I didn't find it frustrating or difficult. Pretty smart if you ask me.

15y agoHN ↗

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.

15y agoHN ↗

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.

15y agoHN ↗

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

15y agoHN ↗

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.

15y agoHN ↗

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).

15y agoHN ↗

Numeric labels also don't work:

  10: PRINT "hello"
  GOTO 10

This works though:

  label: PRINT "hello"
  GOTO label
15y agoHN ↗

Thanks for a quick reply. So having GHCi - the GHC's REPL - successfully emscripted could make adding Haskell support possible, right?

15y agoHN ↗

If it uses a JIT internally, it will produce x86 machine code, which is meaningless to us since we aren't emulating the whole machine. If it doesn't, then emscripting it should work.

15y agoHN ↗

Haskell won't run in a repl, will it? GHCi and Hugs demand that functions be specified in a script file and not at the prompt.

Without functions, you really don't have very much of the Haskell language available. It's a partial repl with a fraction of the language at best.

15y agoHN ↗

Not necessarily. You can define functions in GHCi using let.

  $ ghci
  Prelude> let fact x = if x == 0 then 1 else x * fact (x - 1)
  Prelude> fact 6
  720
15y agoHN ↗

To add to this, each language has an about link and an engine link (shown at the bottom when you select a language). These will take you to a page describing the language and the interpreter we're using, respectively.

15y agoHN ↗

Oops:

  > import subprocess
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/lib/python2.7/subprocess.py", line 429, in <module>
      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 "<stdin>", line 1, in <module>
    File "/lib/python2.7/os.py", line 667, in popen2
      import subprocess
    File "/lib/python2.7/subprocess.py", line 429, in <module>
      import select
  ImportError: No module named select
  > os.popen('ls -l')
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  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.

15y agoHN ↗

Thanks for trying it out.

* The ^W is fixable, but I'm not sure how I personally feel about hijacking fundamental browser shortcuts. We'll look into it though.

* Regarding the environment, in general, multi-threading and multi-processing (and anything that depends on them) are not supported, since Emscripten translates the code to JS rather than emulating a machine.

* The Emscripten virtual filesystem has a simple single-user permission model and the libc functions for accessing/modifying the permissions are supported. So technically you could get the permissions through os.access. Not as convenient as ls, of course, but doable.

15y agoHN ↗

I will note that when copying the text out of the interpreter, the prompt (>) doesn't copy (I assume that you may be using a CSS :after or :before decorator, though I didn't look). Sometimes even the newline itself didn't copy. For that post I had to cleanup all of the text so that it would display properly. This may be an issue you want to look at if you want to support people copy/pasting stuff that they are working on out of the console (or you may just want to add a button that generates a Github gist or pastebin entry and displays a link to it).

15y agoHN ↗

The prompt label is an image, hence it's not copyable. We experimented a bit with various copy-friendly approaches, but couldn't find anything that was cross-browser and did not damage the look/layout we were going for. To share a session, click the save button on the top right - it'll generate a shareable link with the editor content and the whole REPL session in replayable form.

15y agoHN ↗

In Python:

Importing urllib hangs zlib imports, but the compress and compressobj methods fail

import zlib

zlib.compress("askldas")

Internal error: ReferenceError: _deflateInit_ is not defined

15y agoHN ↗

Hmm... Chrome gives me:

The webpage at http://repl.it/ might be temporarily down or it may have moved permanently to a new web address. Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error.

:(

15y agoHN ↗

Wonderful, Nice to see QBasic there. These days its easier to write for modern High Level languages, as they are easily installed and available everywhere. But the classic and beautiful languages are hard to find and even talked about.

Good and nostalgic memories of Programming with the Basic.

:)

15y agoHN ↗

Ouch! Awesome apps like this are totally humbling. Congratulations, guys.

If you're still following this thread, amasad and max99x, I have a simple question: how many hours did you two put into this?

15y agoHN ↗

Really hard to say. We started experimenting with the idea back in March, but didn't start putting fulltime nights into it until August. I'd say a little over a thousand man-hours over the span of 6 months, but I may be well off the mark.

15y agoHN ↗

It was a fruitful experience and if we want to count in the hours of reading and studying that this project has spawned, it would be much more than that.

Anyways, the real question is "how much did it cost?": $1600+ in sushi dinners! :)

15y agoHN ↗

Every time I try Python or Ruby, the interpreter loads almost fully and then freezes.

Lua and Scheme work fine. Also, good job on allowing me to close the tab after I managed to get QBasic locked in an infinite loop. :-) (Dual-core likely helped.)

Firefox 7.0, x86 (32-bit), running on Ubuntu 11.04, x86-64.

15y agoHN ↗

Yes this is a regression with firefox 7+ browsers, the creator of emscripten (@kripken) has already opened a bug in it https://bugzilla.mozilla.org/show_bug.cgi?id=687951 .

And ya, we try to sandbox most of our languages inside a Web Worker, which leaves the main thread intact incase of infinite loops and such.

15y agoHN ↗

This is great stuff. A really good way to play with some languages without needing to install it.

15y agoHN ↗

the QBasic support actually makes me want to try to add Canvas support to it so that

  SCREEN 13
  CIRCLE (4, 3), 4, 4

and all the other stuff I used to have fun with years ago will actually work.

15y agoHN ↗

Actually Steve Hanov's implementation which we're using does have canvas support. You can find it at http://stevehanov.ca/blog/index.php?id=92. We stripped the graphical parts since they make little sense in our UI. At some point we may add graphics support, but if we do it will be to all (or at least the majority of) the languages.

15y agoHN ↗

Wow, really nice. I was looking for a tool to try out some code when working away from my workstation. This fits the bill, its fast and agreable to use. Thanks!