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

World: r4wp

[#Red] Red language group

Pekr
4-Oct-2012
[2521]
I would like to ask about the architecture of Red. I am looking into 
datatypes directory, e.g. string. Those functions don't have any 
arguments, they seem to work with the stack directly? Strange concept. 
Are those real Red functions? But what I don't understand is e.g. 
'back function, its body contains block/back. Where does "block" 
come from? It is not passed as an argument, so is that any kind of 
system wide value?
Kaj
4-Oct-2012
[2522]
There are dispatcher wrappers in actions.reds
DocKimbel
4-Oct-2012
[2523x3]
block

 it's a context, the one that contains all the block! datatype related 
 code.
Yes, all actions and natives work from the stack. Sometimes they 
are just wrappers other equivalent functions that pass arguments 
in a classical way, so they can more easily be called internally 
by other parts.
Strange concept

 It looks pretty classic to me, but there are some specific reasons 
 behind such choice, that I will detail them in a future blog entry. 
 Basically, it simplifies the tracking of Red values on stack (making 
 the work of the GC easier) and stack serialization becomes almost 
 trivial (to memory, for continuation support, or to file, for image 
 support). I think that R3 doesn't do it that way, but probably uses 
 recursion, passing all R3 values on C stack instead. It's a faster 
 approach but less flexible.
Henrik
4-Oct-2012
[2526]
Kaj, I just watched your talk. It was great, but you can probably 
benefit by putting in a diagram or two, showing the relationship 
between REBOL, Red and Red/System.
Kaj
4-Oct-2012
[2527x2]
Thanks. I know, I'm low on glitz. It's because I don't want to take 
the preparation of those talks more time than they already do. I 
prepare by making sure that as much as possible works, and then I 
do a guided tour of it on the machine itself
It's the same reason why I have written only limited documentation. 
I have to prioritise my time to do the things that I need myself, 
and I don't need the documentation and the presentations that are 
a goal in themselves
BrianH
4-Oct-2012
[2529]
R2 and R3 use their own stacks, though recursive PARSE may use the 
C stack. The stack frames of R2 and R3 are different, but I wouldn't 
be able to tell you how.
Arnold
4-Oct-2012
[2530]
Nenad, a small donation from me via Paypal underway.
DocKimbel
4-Oct-2012
[2531]
Thanks Arnold, all donations count and are much appreciated. I'll 
see what we can do for "numbers representing money", but anyway they 
will be less flawed than in REBOL (no approximated internal representation). 
;-)
Henrik
4-Oct-2012
[2532]
binary coded decimals?
Arnold
4-Oct-2012
[2533x2]
Red numbers mean you are in debt, that's not what we want is it ;-)
cheers!
DocKimbel
4-Oct-2012
[2535x4]
This is the plan for handling numbers with decimals:

- decimal!: BCD
- real! or float!: floating point numbers

- money!: BCD or just integer with a scaling of 100 on input/output.
Arnold: got it...now! ;-)
Pekr: your remark about the stack made me think about it. I might 
change a bit the current internal API, collecting arguments from 
stack in trampoline functions (actions.reds) instead, and then calling 
datatypes-specific actions passing them the arguments directly. This 
would reduce the runtime code size a little bit and might simplify 
the construction of the future public API. I need to see first if 
they are drawbacks before deciding to refactor the code in that way.
Those functions don't have any arguments, they seem to work with 
the stack directly? Strange concept. Are those real Red functions?


They are Red actions (the datatype "methods" if you prefer). Polymorphism 
support is implemented through a dynamically created actions jump 
table. If you really want to see how this internal API works, just 
compile small Red test scripts with the -v 1 option (-v 2 will also 
give you the generated output of boot.red compilation).
Kaj
4-Oct-2012
[2539]
float!'s are rational!'s, aren't they?
Andreas
4-Oct-2012
[2540]
All numbers representable in binary floating points are rational 
numbers, but not all rational numbers can be represented (exactly) 
in binary floating point.
Kaj
4-Oct-2012
[2541]
Yes. real!'s are even less well covered, though
DocKimbel
5-Oct-2012
[2542x4]
Kaj: right, strictly speaking, it covers rationals numbers only.
(at least, as subset of rational numbers)
*a subset
Good news everyone: it seems I've removed the reception limitations 
on my Paypal account, so feel free to send new donations.
Pekr
5-Oct-2012
[2546]
I have finally recovered after my credit card fraud. I (hopefully) 
sent 50 EUR, Doc. Please let me know if it arriwes, as for the first 
time, the last name on my Card contains czech char, and my Paypal 
profile does not have any. Hopefully it all resolves well ...
DocKimbel
5-Oct-2012
[2547]
Got it Peter, thank you!
Pekr
5-Oct-2012
[2548]
Good! :-)
Kaj
5-Oct-2012
[2549]
Just finally got my Raspberry to work, after running around all week 
buying additional needed equipment. So maybe I'll have something 
to talk about tomorrow
DocKimbel
5-Oct-2012
[2550]
I got it to work also three hours ago (had only a VGA monitor, passive 
adapters didn't work, I had to find another monitor)
Kaj
5-Oct-2012
[2551]
Yeah, we bought a new one, too, but also an adapter cable from HDMI 
to VGA
DocKimbel
5-Oct-2012
[2552x2]
My USB wifi device works, but the screen resolution is so small that 
I can see only half of the wifi config window. I can't change the 
resolution from the preferences, it just errors out saying it doesn't 
recognize the monitor...
I'll try to fix it in boot config tomorrow.
Kaj
5-Oct-2012
[2554]
Most of the bindings don't work on ARM
DocKimbel
6-Oct-2012
[2555x2]
Does that concern only bindings that rely on callbacks?
I will try to fix those bindings issues on ARM once I release v0.3.0 
in a few days.
Arnold
6-Oct-2012
[2557]
Ah Kaj, could you put up a shopping list of thing to buy too when 
you buy a RaspberryPi?
NickA
6-Oct-2012
[2558x3]
RED FUNDING DRIVE, MATCHING FUNDS CHALLENGE:  to help ensure that 
Doc can continue to work on Red without disruption, I'll match funds 
donated to him by November 1, 2012, up to a total of $1000.
Kaj, we need to get you funded too.
Perhaps some discussion about forming a Red foundation would be helpful 
to organize anticipated future actitivies involving community relations 
or other activities that will keep Doc and other core developers 
from focusing on code.
Gregg
6-Oct-2012
[2561]
Yes, the hope is that we can rally support to do the things, like 
web sites, forum moderation, etc. so core developers (i.e. Doc) can 
focus on development.
Kaj
6-Oct-2012
[2562]
Thanks for thinking about me, Nick. I'll refrain from asking for 
donations until Doc is in a good position, then I'll set up a website 
for the bindings to give sponsors a chance to influence my priorities
NickA
6-Oct-2012
[2563]
Thanks for your work and vision Kaj.  It's so appreciated!
Kaj
6-Oct-2012
[2564x4]
Thanks
Arnold, you want me to give a list of things that you would need 
to get a Raspberry going?
Doc, we're just back from Hardware Freedom Day. My talk turned out 
mostly about the Raspberry, because little Red was working. I haven't 
looked into the causes yet. When I've caught up on sleep I'll start 
sending in bug reports
It's quite possible that it's callbacks, but I'm not sure yet
Bas
6-Oct-2012
[2568]
http://www.youtube.com/watch?v=susYvYoUnUQ
DocKimbel
7-Oct-2012
[2569x2]
Bas: it says "Video is private", so it can't be seen.
Nick: thank you very much for this initiative, it certainly helps 
me keep focused on Red and not have to worry about how to pay my 
bills next month! I hope others will continue to donate, so Nick 
won't need to take all the burden on his shoulders.