Home

Awesome

Red.js

Red.js is a web runtime for the Red programming language that allows you use Red right in your browser. Although it's currently very incomplete, the end goal is to make it as similar to regular Red as possible. While I highly doubt it can happen, it'd also be cool for it to also includes features like web equivalents for Red's View, Draw, Rich-Text, and VID dialects and a version of Red/System that can be compiled to WebAssembly.

STATUS UPDATE

Red.js is currently being converted from TypeScript to Haxe due to a variety of reasons:

I am keeping the old code in the old folder for future reference until the transition to Haxe is complete.

Example usage

NYI

Running

Locally

In order to run this locally, you'll need:

  1. Run haxe build.hxml to build Red.js
  2. Run node bin/main.js to start the Red.js REPL

In a browser

NYI

Current limitations

FAQ

Why not transpile to JS? Wouldn't that be easier and faster than using an interpreter?

This is sadly not possible due to the fundamental differences between Red and JS. In order to support all of the meta-programming features that Red has, it'd be no different transpiling to JS than just embedding the interpreter. There may be a JS dialect of Red.js at some point in the future, but for now it will remain interpreted.

Why do expressions in the REPL print out JS/JSON?

Because it's helpful to be able to easily inspect values when debugging. I'll probably disable it some time in the future.

Why isn't feature X in Red.js if it exists in normal Red?

Red.js is not a perfect replica of normal Red, as there are a large number of things that Haxe/JS cannot do within a browser that can normally be done in Red (due to browser limitations). There could be features that only work when using Node or a different Haxe target, but I would like to mainly focus on features that work on both runtimes.

Do you plan to implement dialects such as Red/System?

I already answered that.

Will Red.js be able to compile to WebAssembly?

I also already answered that.

Why Haxe?

TypeScript is... annoying. It doesn't support nominal typing (even for classes!), lacks real pattern matching, and it's honestly just as unproductive as the language that it's built on.

Haxe, on the other hand, is a very powerful language that not only compiles to JS, but also fixes pretty much everything that I don't like about TS. These things include:

That being said, Haxe does have a few downsides:

Despite these issues, Haxe has been much nicer to work with, and gave me a chance to fix a lot of things that I had originally implemented incorrectly. I've made some macros to help with some of these things, and others have been accepted at the latest Haxe evolution meeting, so I'm hoping that will make the experience better at some point soon.

What can I do to help with development?

Anything helps!

Other notes

Please consider looking at TODO.md and FEATURES.md