• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r4wp

[#Red] Red language group

Pekr
14-Sep-2012
[1664x2]
*Important*: Red will be distributed as a binary to end users and 
the effect of:

    red script.red
    

will be to compile and run it from memory directly. So the -o option 
will become mandatory in the future for generating an executable 
without running it. During the bootstrapping stage, it is complex 
to support that feature, but it will be implementd as soon as possible.
Could you please elaborate? Is red executable going to be kind of 
launcher for our scripts? Hence it compiles them before running it? 
Most probably not a solution for CGI, as the compilation stage will 
happen each time?
DocKimbel
14-Sep-2012
[1666x2]
For CGI, you should obviously pre-compile them if you want performances. 
The future JIT-compiler should be able to handle such cases fine 
though.


But yes, the goal is to be able to run Red scripts directly in the 
same way REBOL does. The fact that Red compiles them should be transparent 
to users. The -o option will be roughly equivalent to what encap 
provides (except that scripts will be compiled to native code).
The main drawback right now to support direct Red script execution 
is REBOL inability to execute native code from memory. The workaround 
would be to provide a DLL to pass the memory pointer and call the 
Red code, but as I aim at a single Red binary, this option wouldn't 
be very satisfying.
sqlab
14-Sep-2012
[1668]
I would prefer Red to compile either to the directory, where the 
source is by default or at least not to the system/options/home path, 
but to the path I get with pwd
DocKimbel
14-Sep-2012
[1669]
Agreed, change done.
sqlab
14-Sep-2012
[1670]
That's quick. Thanks
DocKimbel
14-Sep-2012
[1671]
I got math ops for integers working, but I think it's time we get 
a better macro system.
PeterWood
14-Sep-2012
[1672x2]
quick-test has been broken by one of the last 13 commits in branch 
v0.3.0. I'll try to sort it out over the weekend.
That was under OS X, it runs okay under Windows.
Arnold
14-Sep-2012
[1674]
So time really is running out for REBOL
PeterWood
14-Sep-2012
[1675]
quick-test is also broken on Linux.
DocKimbel
14-Sep-2012
[1676]
Peter: let me know if I can help.
NickA
14-Sep-2012
[1677]
Very exciting to compile hello.exe on my Windows PC!
DocKimbel
14-Sep-2012
[1678]
Kaj: what do you think of that? (for Red/System)

    #define MAX(a b) [either a > b [a][b]]

    print MAX(78 12)

outputs: 78
Arnold
14-Sep-2012
[1679]
Try it the other way around ;-)
DocKimbel
14-Sep-2012
[1680x2]
Huh! :-)
Works! (was testing in the wrong console)
Arnold
14-Sep-2012
[1682x2]
That's good ;)

I take it for granted that this is just on the way to having maximum: 
max block-of-values ?
and it returns the max in maximum?
Gregg
14-Sep-2012
[1684]
I think he's just working on macro support in this example.
Arnold
14-Sep-2012
[1685]
that makes sense.
DocKimbel
14-Sep-2012
[1686x4]
Arnold: it's for Red/System, not Red.
Nice features of the new macro support: 


- the replacement in the argument block operates for any block series 
(includes paths types)

- nested macros in macros are resolved


- you can define the argument as paren! instead of block!, and paren! 
will then stay once macro resolved.
Here's a more complex example:
    
    #define MIN(a b) [ either a < b [a][b] ]
    #define MAX(a b) [ either a > b [ MIN(p/a p/b) ][p/b] ]

    p: "Hello"
    print MAX(2 1)

outputs: H
(in fine, MAX(2 1) resolves to: p/1)
Arnold
14-Sep-2012
[1690]
Nenad, thank you for the explanation. Good to know even the simple 
test works both ways, and I am a programmer not a tester ;)
DocKimbel
14-Sep-2012
[1691]
New macro system pushed online in the v0.3.0 branch. If anyone needs 
it in other branches, let me know.
szeng
14-Sep-2012
[1692]
hello.red segfaults on my ubuntu 12.04 system, any idea?
DocKimbel
14-Sep-2012
[1693]
No, I haven't yet tested the Red codebase on Linux, but I will in 
a few minutes.
szeng
14-Sep-2012
[1694]
So I am the first one to test it on linux? :)
DocKimbel
14-Sep-2012
[1695]
It looks like. ;-)
szeng
14-Sep-2012
[1696]
Cool, it compiles anyway.
james_nak
14-Sep-2012
[1697]
Doc, did you know you have a possible theme song? It goes back to 
when I was a young lad but it still rocks:  "Red" by Sammy Hagar. 
http://www.youtube.com/watch?v=sfdy7tC-Us0&feature=fvwrel
DocKimbel
14-Sep-2012
[1698]
Nice Red rock song. :-)
GrahamC
14-Sep-2012
[1699x5]
I did this 
$ git clone https://github.com/dockimbel/Red.git

so how come red.r doesn't come down?
I got the redme.md and the license ...
hmm..lots of files don't come down
ooops .. my bad
anyone know how to pull this branch down?
DocKimbel
14-Sep-2012
[1704]
If your `git clone`succeeded, `cd`inside the repo, and do a `git 
checkout origin/v0.3.0`
GrahamC
14-Sep-2012
[1705]
thanks .. found the answer on SO too
DocKimbel
14-Sep-2012
[1706x2]
Math operations now supported in Red (integer! values only for now). 
For example:

    a: 123
    a: a + 2
    print a * 6 - a

will correctly output 625.
@szeng: I will look into the Linux issue tomorrow.
Kaj
14-Sep-2012
[1708x6]
I'm awed by the great elegance of it all
The code is very accessible
I like the new macro system, too. I've wanted that for a long time 
(in silence :-)
We'll inform Peter Busser that Red supports round brackets now ;-)
I've updated the recipe in the Syllable build system to add Red:
http://syllable.cvs.sourceforge.net/viewvc/syllable/syllable/system/apps/utils/Builder/packages/Red--current/