Red programming language 0.6.2: LibRed and Macros
red-lang.org
red-lang.org
REBOL being proprietary when the big F/OSS scripting languages were taking off in popularity was probably a problem for mindshare and community breadth.
I stumbled upon this site in my search though http://red.reb4.me/
https://news.ycombinator.com/from?site=red-lang.org
And from that I saw:
http://www.red-lang.org/2015/01/dream-big-work-hard-and-make...
which mentions the funding etc.
REBOL had some novel ideas, and some shortcuts for some particular types of development making for strikingly concise code in some specific cases, and overall a nice design. I think it's neat that there's an OSS implementation, but I have so many other things on my todo list that I've never done more than give it a glance. I just don't see how I'd make productive use of it in the kinds of projects I do (given interop requirements I have).
It may come. JIT is planned. I don't know of any language that wants to be slow, and I can only speak for myself, but I think Red's goal is one of overall performance. In 1991, people told me I couldn't use VB, because it was too slow. I countered that my app would be 12-18 weeks faster than their C app. :) Still, this is 2017 and we have options.
Red won't be fast enough for everyone, or everything. But it will be faster than a lot of alternatives for many purposes. What kind of stuff do you need maximum performance for, how much of your work is that, and what are some of your real-world examples and performance criteria? I work best with concrete examples.
A cheat, though, would be extracting lowest-level form to C to leverage their compilers. Lots of languages did that.
I have been following Red from a distance waiting for it to be ready for the kind of usage I want to put it through (mostly small desktop apps). I think that Red / REBOL are among the most fun languages to use for personal projects.
PS: Brazilian, not Czech...
Our REBOL experience was also not related to embedding but towards expressiveness and quick prototyping.
I think I expressed myself badly, when I said "Brazilian, not Czech", I was just referring to myself, as a new non-Czech datapoint :-D, Red is not Brazilian.
- Native (bridging to Obj-C)
- JVM
- CLR
While also supporting shared objects so my assumption is that dynamically linking is possible.On top of this it looks like they want to support a sort-of wxWidgets-like GUI programming (which I personally believe to be the correct approach to GUI abstractions). Backends they aim to support:
- Windows (done)
- GTK+
- macOS
- iOS
- Android
This reminds me of the approach a lot of JVM focused languages are taking like Clojure that support the CLR, JVM, Node and Web Browser.I guess the obvious questions to ask would be:
1. Any reason for not wanting to target WebAssembly/JavaScript (and in conjunction node.js [I understand that this isn't trivial])?
2. Any reason targeting QT isn't on the roadmap? [targets for KDE, Sailfish, ect..]
3. Any reason wxWidgets wasn't a great choice as a foundation? (I believe they have a C API last I looked)
4. Is there or will there be an API for creating custom languages that can target/leverage Red's infrastructure? (basically a Red version/wrapper for flex/bison)
Finally, adding support for Erlang nodes should be fairly trivial if it was a wrapper to the C Node API, but it could also be implemented via a pure Red implementation.
tl;dr I'm interested to see how Red will evolve further not necessarily because the syntax intrigues me, but because of the goals the team have set for themselves as far as polymorphic runtimes go.
EDIT: formatting
Wasm will likely be the browser target.
> 2. Any reason targeting QT isn't on the roadmap? [targets for KDE, Sailfish, ect..]
They wanted to go native to start. QT is GPL licensed. Not a good fit for Red. Their "small" installer, which downloads the big stuff, is 18M. Red, with self-contained toolchain and cross compiler + GUI, is 1MB.
> 3. Any reason wxWidgets wasn't a great choice as a foundation? (I believe they have a C API last I looked)
Targeted at C++, and also very large.
> 4. Is there or will there be an API for creating custom languages that can target/leverage Red's infrastructure? (basically a Red version/wrapper for flex/bison)
You can use libRed, which makes Red available as a DLL you can call into from other langs, like C. See http://www.red-lang.org/ where a couple GIFs show integration with VBA and Excel even.
Ultimately, the decision not to use something comes from value added and available resources. Team Red is small, and has to pick their battles carefully.
Wrong. It is triple-licensed (GPL, LGPL and commercial).
I think that this is backwards; Red is inspired by Rebol, which is relatively old:
> Red is a computer programming language. Red was made to overcome the limitations of the programming language Rebol.
(https://en.wikipedia.org/wiki/Red_(programming_language) ).
>> words: keys-of system/words
>> types: collect [forall words [if datatype! = type? get/any words/1 [keep words/1]]]
>> probe types
[datatype! unset! none! logic! block! paren! string! file! url! char! integer! float! word! set-word! lit-word! get-word! refinement! issue! native! action! op! function! path! lit-path! set-path! get-path! routine! bitset! point! object! typeset! error! vector! hash! pair! percent! tuple! map! binary! time! tag! email! handle! image! event!] help datatype! ipv4`192.168.0.1`
and get your object. Are there other benefits besides a literal syntax? (Not to slag on Red. One advantage I can see is avoiding the call at runtime to the ipv4 function.)A couple other new features make dealing with non-loadable input easier too. You can use macros to pre-process data, trap errors that `load` triggers and still get back a block of values, or spec some simple rules in `system/lexer/pre-load`. That's another way we might deal with IPv6 values.
Red doesn't have all types in place yet (e.g. date! is coming, and maybe an @ref type, among others), but can still load the following:
at 10:00 send gregg@host.dom a link to http://red-lang.org (216.239.32.21)
delete %/c/temp/junk.dat
assign #DECAFBAD-7337 to John
make the main window 800x600 with a color of 255.0.0
answer: yes
Here's a quick console session showing what types it found: >> blk: [ at 10:00 send gregg@host.dom a link to http://red-lang.org (216.239.32.21)
[ delete %/c/temp/junk.dat
[ assign #DECAFBAD-7337 to John
[ make the main window 800x600 with a color of 255.0.0
[ answer: yes
[ ]
== [at 10:00:00 send gregg@host.dom a link to http://red-lang.org (216.239.32.21)
delete %/c/temp/junk.dat
>> unique collect [foreach val blk [keep type? val]]
== [word! time! email! url! paren! file! issue! pair! tuple! set-word!]
And you can parse at that level: >> parse blk [
[ some [
[ 'window set val pair! (print ["size:" val])
[ | 'assign set val issue! (print ["issue:" val])
[ | 'link 'to set val url! (print ["link:" val])
[ | skip
[ ]
[ ]
link: http://red-lang.org
issue: DECAFBAD-7337
size: 800x600
Of course, you could do something similar in ES6. If you use template literals, your data might look like this: at time`10:00` send email`gregg@host.dom` a link to url`http://red-lang.org` paren`(ipv4`216.239.32.21`)`
delete file`%/c/temp/junk.dat`
assign issue`#DECAFBAD-7337` to John
make the main window pair`800x600` with a color of color`255.0.0`
name`answer:` bool`yes`
Sorry for getting carried away. :)Oh, very high I would say
I liked this big:
>> unique collect [foreach val blk [keep type? val]] == [word! time! email! url! paren! file! issue! pair! tuple! set-word!]
I think it could almost be read and understood by a person who does not know REBOL or Red.
"Red or REBOL" = Redbol (sounds like Red Bull) :) And where Perl has Mongers, Ruby has Rubyists, Python has Pythonistas, and Rebol has Rebolers, Red has Reducers.
In IPv6 or in Red, you mean?
In IPv6 the colons are there for convenience only, with the rule being that leading zeros can be omitted and that two or more consecutive groups of all zeros can be replaced with ::. You can only have one instance of :: otherwise it would be ambiguous.
For example, the IPv6 address ::1 is actually 0000:0000:0000:0000:0000:0000:0000:0001.
Likewise, 2a03:2880:fffe:c:face:b00c:0:35 is actually 2a03:2880:fffe:000c:face:b00c:0000:0035.
Once an IPv6 address has been expanded to it's full non-abbreviated form you can safely strip it of colons and use the resulting hexadecimal value to uniquely represent that address.
If you were talking about colons in Red and not in IPv6, disregard what I said.
I am kind of excited to try something so large in scope and so different, but no Linux support would kill it before I even downloaded it.
But I can wait. It's open source and free, gift horse mouth and all that. Can't fault the developers for prioritising either areas for which they currently can get funding, or scratching itches in their own dev environment.
Another thing to get used to is the ability to include characters in names that you normally can't, e.g., - and ?.
I'm not convinced that is actually a good thing. It really annoys me when two libraries for the same language use different naming conventions, and so far I haven't had any trouble with the strict casing rules in Haskell, or the casing conventions in Rust where the compiler emits warnings when you don't follow them (that you can disable with an annotation if you really need to).
https://marketplace.visualstudio.com/items?itemName=red-auto...
i did take a glance at the documentation but did not find the answer to this question - without knowing how the thing allocates memory it is sort of pointless to invest time into learning the language...
Why do you think it's pointless to learn without knowing how it handles memory?
> Why do you think it's pointless to learn without knowing how it handles memory?
I think that a non trivial program will have to employ dynamic memory allocation, so if it is not obvious how to do that then it will not be possible to write a complex program. Learning a language that can handle only simple cases may have some uses, but you already have existing tools for that.
Red's complete toolchain, compiler, linker, etc. are bootstrapped entirely in Rebol2. Red is more capable than R2 (though alpha, with features pending), so it's safe to expect that it can handle more than simple cases. In fact, one of the reasons Red 1 was implemented in R2 was to prove that Red would be able to self host. It's possible most of the current toolchain would even work at 1.0, but the team has learned a lot while building this version, and has said on many occasions that Red 2 will only keep the best bits.
All that said, even if you never use it in production, it's a great language to play with and expand your thinking, because it's so different.
- GC is added after a lot of language is already there.
- Actors are planned to be added _after_ I/O, and _after_ GC, and _after_ all the GUI capabilities (Trello board lists "figure out how to rewrite event loop with actors")
- A lot of FFI is already there, so GC, and actors are coming after FFI.
These are not features you add on top of a language and hope they magically work. Actors directly affect how I/O and GC work. GC should be very aware of how FFI works. etc.etc.etc.
A lot of these issues are dismissed by the core team as "it's not difficult to write a GC, we have it in a branch somewhere" (referring to a naïve mark-and sweep stop-the-world GC).