📜 ⬆️ ⬇️

Interview with Nenad Rakocevic about Red, successor to Rebol

After our last interview with Brian McKenna for This is not a Monad tutorial, we interviewed Nenad Rakocevic , the creator of the Red programming language.

From my subjective point of view, Red and Rebol are rather strange creatures! But do not misunderstand me, it does not mean anything bad. For example, I do not know many high-level languages ​​with features like embedded DSL for standard low-level programming or 50 built-in types. You should try it, you will find a lot of interesting ideas in programming on Red.

Email me on @unbalancedparen your comments or interview suggestions for This is not a Monad tutorial. Stay with us!
')


Tell us a little about the appearance of Red. What was it for?


I started to program micro-computers, Amiga, in my case, in my youth. At the moment I am programming more than 30 years. After my first experience, I was unhappy with existing programming languages ​​and tools. Mainly due to the fact that they were not quite productive or friendly to me. So, when I stumbled upon Rebol in 1999, he opened my eyes to what was wrong with the so-called "modern" development practice. (Nowadays everything is still worse). Dealing with complexity on all fronts of software has become a logical course of action.

In 2010, Rebol source codes were closed. I acutely felt that his approach could offer much more, but Rebol practically did not develop. This was the signal to start working on an open source relative Rebol, with much greater ambitions and a wider scope.

What are the main arguments for Red?


What made Rebol the main inspiration for Red?

Rebol is one of the most innovative programming languages ​​created in the last 20 years. Unfortunately, he remained out of sight as he had closed source code, while open source languages ​​like Perl, Python and Ruby made their way into the industry. Rebol’s approach undermines the very foundations of what programmers consider to be “simple” or “effective” in development. In general, the API, which in other languages ​​would be called “simple,” seems pointlessly complicated when you are used to looking at the world through Rebol's glasses. ;-) Here are a few one-liners for example (for the Rebol2 REPL):

Create a graphical window with a button, by clicking the “Hello” type to the console:

view layout [button “Click Me” [print “Hello”]] 


Print the contents of the web page to the console:

 print read http://rebol.com 


Get webpage title:

 parse read http://rebol.com [thru <title> copy text to </title> (print text)] 


Send a list of files in the current directory by email:

 send user@domain.com mold read %. 


Get all the records from MySQL and print them:

 foreach row read/custom mysql://root@localhost/books [“SELECT * FROM authors”] [print row] 


Note that even though you have never seen Rebol code before, you can still read it and understand what most of it does.

What is the main difference between Rebol and Red?


In addition, the languages ​​themselves are very similar, somewhere around 95%. If you know Rebol, you know Red.

Red covers a whole class of abstractions between low-level and high-level programming, offering a Red / System dialect with C-like semantics and Rebol-like syntax. Was there a difference between Red and Red / System in the original design? What benefits did you get using Red / System?

Of course, Red / System was one of the main reasons for creating a new language stack, instead of duplicating the Rebol implementation. Red / System is a statically compiled language intended for native code (like C). Red / System serves two main purposes:


As far as I know, Red is the first high-level language with features like embedded DSL for universal low-level programming.

Who uses Red / Rebol?

The Rebol community was relatively large in the early 2000s, but it was greatly reduced with the cessation of development. The set of users was surprisingly diverse in terms of skills. Many people liked simplicity for simple tasks and a cross-platform GUI engine, others were more interested in depth (dynamic linking, easy creation of DSLs, serious meta programming capabilities, ...).

Since then, only hardcore fans or companies that have built their systems on it continue to use and promote it. In many ways, they are the same people, and they formed the first Red followers, along with many other people who were interested in Rebol, but were not satisfied with its proprietary nature. Some of them write libraries for Red, others - small toys, or even drivers for Windows devices! :-) As soon as Red becomes ready for production, we are sure that many more people will join them and will enjoy using Red.

For what tasks do you think Red is suitable?

Red is a general-purpose software solution that should be good enough for any programming task. In practice, this is limited to (only) available frameworks and libraries. So Red is very well suited for these tasks:


Once we reach 1.0 (next year), Red will also be very good for:


Rebol and Red provide a huge variety of built-in types for practical applications. Some people think it is better to have a small core of language capabilities. What do you think about this account?

Rebol and Red have more than 50 data types with a runtime of just over 500KB. Among them, two thirds have a special literal form (eg money, email, url, time, date, colors, ...), which gives you, out of the box, a rich set of literals for creating embedded DSLs.

Another plus is that most of the capabilities required for everyday tasks are already here, as first-class objects, perfectly integrated with the rest, work exactly the same on each supported platform. This greatly increases productivity and makes learning / using a language much more enjoyable (there is no need to do “imports” for each simple task). Such languages ​​are pragmatic and aimed at reducing the cost of creating software.

How is Red implemented in general? Are all components (parsers, code generators, garbage collectors, etc.) written by hand? What are Red's dependencies?

Except for the good part of the unit tests that are generated by the script, everything else is written by hand. We deploy Red using Rebol, so the toolchain (compilers, linker, collectors) is written in Rebol2. Rebol has a DSL for parsing, which is very effective and, combined with the powerful meta programming capabilities, the need to use other tools just disappears. Red scripts can be interpreted from the REPL or compiled into native code, using Red / System as an intermediate representation. The rantaym library consists of a mixture of code on Red and Red / System.

Red executable files usually have a size of about 0.5MB and have no dependencies.

How complete is Red in mid-2015?

A lot has already been implemented, so I’d better describe what is still missing. Right now we are completing cross-platform GUI support with the first backend for Windows. The backends for Android, Linux and OS X will be as follows. I / O is still limited to simple file operations and an HTTP client. Modular compilation, a full-fledged garbage collector and competitive support are the main goals before release 1.0. We are planning to release 1.0 in 2016.

How do you see the future of Red?

Red has the potential to seduce many developers (especially free developers who have the freedom of choice) who are not satisfied with existing tools (even the so-called “simple” ones). I expect Red to spread widely over the next couple of years, helping programmers to solve many different problems with pleasure and making their lives easier. Red will expand with many powerful DSLs for different areas, offering excellent replacements for the direct use of existing libraries. For example, we will promote it in the areas of robotics and AI.

What are the most important conclusions you made from the development of Red?

  1. Open source is the best way to create quality software (Red just confirmed this fact again).
  2. Working "in the open" is not always good, sometimes you need to isolate yourself from the surrounding "noise" to complete a complex task (mainly in design). As the project grows, it becomes more and more difficult.
  3. The need to interact with a growing community of users eats up a lot of time. It is very important to find people for this task.
  4. Good syntax design is much more complex than good semantics design. This is missed by many language makers, which leads to excellent semantics but a terrible syntax.
  5. Writing a compiler in a native code for a statically typed language is not really difficult, most programmers with minimal knowledge of computer science are capable of it, they just aren't aware that they can.
  6. Premature optimization can (often) hit you from behind. The knowledge that your optimization is premature is from the category of black magic.
  7. Any big project should start with a team of at least two very motivated and equally qualified developers. Working alone on large projects is crazy, not a guarantee of better results.
  8. If you are working on an open source project that is attractive enough and is gaining followers, you can live on user donations (I lived this way for two years, covering all my basic living expenses). I did not think that it was possible when I started and did not count on it at all. Maybe I was just lucky that Red has such a great community.

What do you recommend reading for writing the first programming language?

A good overview of all the necessary things is in books such as Modern Programming Languages: A Practical Introduction . If you want to go deeper and dive into more abstract categories, the " Book of the Dragon " is still the best one ( Williams has recently released a translation of the latest edition - a translator) .

But the most useful way is to study the implementations of several small languages, this will give you a better understanding of how to do it yourself. For example, the release of Red 0.1.0 is only 24KB in a zip-archive, but it already has a working compiler / linker for Red / System and many features (including FFI). Download it here: https://github.com/red/red/releases/tag/v0.1.0

What languages ​​and technologies do you observe?



From the translator : I almost did not see any references to Habré and just do it in the CIS IT space of the Rebol language, so I will give some background information about it.
Carl Sassenrath - the creator of Amiga OS, which brought multitasking to personal computers, programs in languages ​​such as Ada, Pascal, Smalltalk, Lisp, Forth, SPL. He worked in Apple's research division with many IT legends, including Alan Kay, Larry Tessler, Dan Ingalls, Bill Atkinson, who helped shape his understanding of languages ​​and systems. In 1996, when Java began to gain popularity, he decided to share Perl and Python with the world his ideas, resulting in the REBOL (relative expression-based object language) language. However, as mentioned in the interview, the language was proprietary, distributed in various “packages”, and some of them were only available under license. Later Carl made REBOL3, with initially open source code, but it is very far from the possibilities of REBOL2 and as of today it does not develop. At this time, Red was already actively developed.

If you are interested, I strongly recommend playing with REBOL2, download on the official website http://www.rebol.com/download.html version 2.7, try this megabyte binary with network stack, graphical interfaces and other things, get a gap of patterns for how compact write so many things and start exploring Red / REBOL =)

Source: https://habr.com/ru/post/265685/


All Articles