As we are getting closer to the end of the alpha period, we are now moving to a more convenient way to use and distribute the Red toolchain. So far, you needed to download a Rebol interpreter and the sources from Github separately, and run it using, a bit verbose, command-lines. This is fine for developping Red with contributors that are interested in the inner workings of the toolchain, but for the end users, the goal has always been to provide a simpler and much more convenient way, like Rebol teached us in the past.
So, from now, you can get Red as a single binary (< 1 MB) from the new Download page. Yes, all of Red toolchain and runtime is packed in that small binary, even the REPL is built-in!
The Red repo landing page has been reworked to show Red usage in binary form, all previous command-line options are present, a new one (
-c) has been introduced. Here is a short overview of the main options:
Launch the REPL:
Run a Red script directly (interpreted):
$ red <script>
Compile a script as executable with default name in working path:
$ red -c <script>
Compile a script as shared library with default name in working path:
$ red -dlib <script>
Compile a script as executable with alternative name:
$ red -o <new> <script>
Compile a script as executable with default name in other folder:
$ red -o <path/> <script>
Compile a script as executable with new name in other folder:
$ red -o <path/new> <script>
Cross-compile to another platform:
$ red -t Windows <script>
Display a description of all possible options:
$ red -h
-c option is implied when
-t are used. It is designed to keep command-lines as simple and short as possible.
Moreover, for standalone Red/System programs, the Red binary will be able to compile them directly, no special option needed, they will be recognized automatically.
Thanks very much to Tamás Herman for helping with setting up the build farm and providing the Mac OSX machine, and thanks to the HackJam hackerspace group from Hong-Kong for the hosting!
As we are moving closer to the beta state, version numbers will increase faster, e.g., once objects will be done, the release will be the 0.5.0, while 0.6.0 will bring full I/O support. Between these major versions, smaller versions should be still possible, this means that the release cycle should accelerate with at least one release each month from now on. So, what you should expect in the next ones’
Time has finally come to release the new REPL for Red. A preview version has been pushed last Christmas, since then a lot of work has been done on several fronts (about 310 new commits, excluding merges): interpreter (DO), runtime lexer (LOAD) and console. But before going into details for the REPL, here is an overview of the changes in this new release:
, issue!, file!
do, load, reduce, compose, switch, case, stats, platform’, quit
Moldoutput for string! and char! deeply improved, special characters are now correctly escaped.
This is the biggest part of this new release. The REPL has several components:
donative. It has been developped in Red/System and is about 700 LOC long. All Red compiler tests are run against the interpreter too, all are passing except for the unimplemented yet exit and return (6 tests).
loadnative. The runtime lexer current version only support Latin-1 encoding, a full Unicode lexer will replace it soon (it is a work in progress).
The interpreter and runtime lexer and now part of Red’s standard library, so they are bundled with every compiled Red script. The overhead is about 30KB in the final binary, making it almost unnoticeable. The console is a separate script, that can be compiled easily producing a small standalone binary.
An important feature of the Red interpreter is that it is not only meant for the REPL support, but is actually used by the compiler to solve some code patterns that are too dynamic to be statically analyzed and compiled. Moreover, the interpreter has the ability to call pre-compiled code, so as soon as possible, it can drop back to native code execution. Both compiled and interpreted code are deeply collaborating to provide the most flexible language semantics while ensuring the maximum performances. With the future addition of a JIT-compiler, we will be able to reach the optimal internal architecture.
On the more practical side, to compile the console, from Red root folder, just do:
do/args %red.r "red/tests/console.red"
That will give you a
console binary in the working folder. When you run it, you should see:
-=== Red Console alpha version ===- (only Latin-1 input supported) red>>
This is the Red prompt where you can input any valid Red expression, they will be evaluated on Enter key pressed. Use
quit to exit the console. Remember that there is no yet proper error management, current error messages are hardcoded, and in some cases, you will be thrown out of the console (that is why it is still an alpha version as stated by the console banner). Note that it is possible to copy/paste Red scripts directly into the console.
Anyway, feel free to experiment.
In order to more easily interface Red and Red/System, a new function datatype has been added: routine!. A routine is Red/System function defined in a Red program. The routine specification takes Red datatypes as arguments and return value, and the routine will automatically convert them to appropriate Red/System types when called. For example:
increment: routine [ n [integer!] return: [integer!] ][ n + 1 ]
Here you can see how the Red integer! argument get marshalled forth and back to Red/System integer! datatype for you. For now, routines automatically converts integer! and logic! datatypes this way. Other Red datatypes are passed as their Red/System counterparts as defined in Red’s runtime (see %red/runtime/datatypes/structures.reds). Optional arguments are not supported by routines, as such feature does not exist in Red/System for now.
You can now very easily extend Red with routines using the full power of Red/System! Compiled routines can be run from interpreter too.
We are now moving to Trello for tracking the tasks about Red development. The short-term ToDo list is pretty accurate and updated regularly, you can now follow us more closely. We only started using it a month ago, so not all the tasks (especially the mid-term/long-term ones) are inserted there yet.
Thanks for all the support received for getting this major release out!