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

World: r4wp

[#Red] Red language group

DocKimbel
9-Jan-2013
[5229x2]
About reflection, will there be a compile option to turn it off, 
for commercial code that should stay closed?


What I planned so far is a compile option to switch between different 
modes of bundling the functions/routines source code into the final 
executable. Main options are: 

- in form of native "build instructions" (the current behavior)
- in form of compressed text


The latter option will generate smaller executables, but will be 
slow down boot time a little, as it will require the interpreter 
to process it. The former option provides a high level of obfuscation, 
that requires a lot of work to decompile (cracking REBOL's SDK protection 
is probably an easier job).
interpreter => tokenizer
Kaj
9-Jan-2013
[5231]
Hm, I guess interpreted functions make it hard to leave out the source 
in some form. That would be another argument for being able to designate 
it per function
DocKimbel
9-Jan-2013
[5232]
Actually, every statically defined Red function will get compiled, 
only functions created at runtime will be passed to the interprerter 
(or JIT-compiled).
Kaj
9-Jan-2013
[5233]
Yes, but the source is still included for reflection, isn't it? That 
could be removed
DocKimbel
9-Jan-2013
[5234x2]
So the "interpreted functions" do not exists at compile-time nor 
in the executable in source form, as their are created at runtime.
they
Pekr
9-Jan-2013
[5236]
what about function argument, like in Rebol? I mean, those catch 
etc. arguments?
Kaj
9-Jan-2013
[5237]
I thought the source is added as extra for body-of?
DocKimbel
9-Jan-2013
[5238]
We could remove the body block of compiled function! values, yes, 
so it doesn't get added to the executable. That could be an optional 
switch that would also disable undefine 'body-of accessor.
Kaj
9-Jan-2013
[5239]
Yes, that's exactly what I mean
DocKimbel
9-Jan-2013
[5240]
Pekr: I don't understand your question, could you be more specific?
Pekr
9-Jan-2013
[5241]
Doc - Kaj wants some option to trigger functions being complied in 
various ways. I just said, that maybe it can be done on per function 
basis, using special parameters ...

my-func: func [[dynamic] a [integer!]][]
Kaj
9-Jan-2013
[5242]
Yes, I was also thinking in that direction
Pekr
9-Jan-2013
[5243]
The problem might be, that it has to be decided during compile time, 
so the source code would have to be analyzed. Otoh it might be the 
right place (instead of preprocessor) to fit in, along with catch, 
throw ....
DocKimbel
9-Jan-2013
[5244x6]
You can still define it at runtime in such case, instead of statically 
define it. No need to add another attribute.
Functions created at runtime will always retain their body block.
You will be able to achieve that using different approaches:

1) Using DO: do [foo: func [...][...]]

2) Indirectly specifying the spec and/or body block: 

    body: [...]
    foo: func [...] body
This will result in 'foo function been created at runtime (then JIT-compiled 
or interpreted on each call).
Kaj: you should add your syntax proposition for keyword! + issue! 
to github tracker as a wish, so we don't forget about it.
If we don't find any big drawback, I think I will implement it.
Kaj
9-Jan-2013
[5250]
OK, thanks
DocKimbel
11-Jan-2013
[5251]
Added routines invocation support to interpreter.
Pierre
11-Jan-2013
[5252]
Congratulations: the rhythm of changes in Red is just fast!

I scripted a little command that I run from time to time, just to 
see how both Rebol3 and Red are going:
cd ~/dev/Red/ && git pull && cd && cd dev/r3/ && git pull

And I can see through gitk that the rythm of Red's work is just amazing. 
Courage!
DocKimbel
11-Jan-2013
[5253]
Merci Pierre ! :-)
Pierre
11-Jan-2013
[5254]
De rien, merci à toi!

I cannot really find a startup guide for Red: so, if no one shouts, 
I'll try to write one, during my long hours of flight next week.
Kaj
11-Jan-2013
[5255]
That would be good
Pierre
11-Jan-2013
[5256]
ok, then!
DocKimbel
11-Jan-2013
[5257x3]
Pierre, have you scrolled down throw this page: https://github.com/dockimbel/Red
?
through
Let me know if there are missing information there.
Pierre
11-Jan-2013
[5260]
I had read another version of these instructions; it looks like it 
was reworked a bit.
DocKimbel
11-Jan-2013
[5261]
Yes it was, the Red/System README was merged in Red's one.
Pierre
11-Jan-2013
[5262x3]
I looked into the docs subdirectory, ran
rebol makedoc2.r 

It made red-system-quick-test.html, but then I got my eyes sore with 
the black background, so I wanted the light version, clicked and 
... oops:

Firefox ne peut trouver le fichier à l'adresse /home/pierre/heaume_pierre/developpt/Red/docs/$LIGHT$.
I found a reference to $LIGHT$ at the bottom of red-system-quick-test.txt 
, in what looks like a rebol script below a make-doc document.
REBOL []

do/args %makedoc2.r 'load-only
doc: scan-doc read file: system/options/script
set [title out] gen-html/options doc [(options)]

file: last split-path file
replace file ".txt" ".html"
file2: copy file
insert find file2 "." "-light"
replace out "$DARK$"  file
replace out "$LIGHT$" file2

write file out
replace out "dark.css" "light.css"
write file2 out
DocKimbel
11-Jan-2013
[5265]
Makedoc format allows the addition of REBOL code at the end. The 
proper way to generate the doc files is to CD to the folder, then 
run REBOL on %red-system-quick-test.txt
Pierre
11-Jan-2013
[5266]
ok
DocKimbel
11-Jan-2013
[5267]
BTW, you can find these documentations already generated online here: 
http://www.red-lang.org/p/documentation.html
Pierre
11-Jan-2013
[5268]
Isn't it a bit dark?...
GrahamC
11-Jan-2013
[5269]
It's to save power ... fewer photons emitted
DocKimbel
11-Jan-2013
[5270]
What? The site or the docs?
Pierre
11-Jan-2013
[5271x3]
;-) the site emits too few photons
to my taste...
Something that I miss, from this doc page, would be a "getting started" 
with a step-by-step guide to start coding in Red
GrahamC
11-Jan-2013
[5274]
Red on black is just nearly invisible.
DocKimbel
11-Jan-2013
[5275]
Well, I try to switch to dark themes to both save powers and my eyes. 
;-) 


I've provided a switching option to more classical "light" theme 
for the docs, but doing the same for the web site was too much work 
for me, so I've left it with the dark theme only. I will fix that 
once we get a new web site for Red (or if someone skilled enough 
can make the changes, I'll be glad to push them online).
Pierre
11-Jan-2013
[5276x2]
yes; and white on black with my firefox fonts is quite painful. I 
have a nuclear power plant nearby, providing enough electrons moving, 
so that I can afford to waste a few photons...
don't worry about this... just a detail
DocKimbel
11-Jan-2013
[5278]
Graham: it renders well here, but I don't use Clear Type. I plan 
to make some typographic changes to the blog anyway to make it more 
easily readable, I'll see if I can improve the rendering of red text 
parts.