r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

BrianH
31-Mar-2009
[13460x2]
I think I saw it mentioned on Usenet. We had Joel Neely too - he 
wrote the R1 interpreter, which was so slow (because it was like 
Scheme) that Carl had to rewrite it from scratch: REBOL 2. That is 
why Neely flames REBOL on the Scheme lists.
(I may have the name wrong though - I'm really bad at names.)
[unknown: 5]
31-Mar-2009
[13462]
Wow, I remember that name but didn't know about the flames.
BrianH
31-Mar-2009
[13463x2]
If I got the name wrong, sorry Joel :(
It looks like I *did* get the name wrong. Can't remember the right 
name either, but the flames went on as far as last year :(
Anton
31-Mar-2009
[13465]
Joe Marshal ?
BrianH
31-Mar-2009
[13466x2]
Yeah, that might be it.
Yup, first hit on Google.
Graham
31-Mar-2009
[13468x2]
Joel Neely works for Fedex
and he too has moved on
BrianH
31-Mar-2009
[13470]
Again, sorry Joel. He was fun too - lots of long, essay-like posts.
Sunanda
1-Apr-2009
[13471x3]
I think you are thinking of Joe Marshall who worked on an early REBOL, 
and has been critical of his continuations being removed from later 
versions.
http://ll1.ai.mit.edu/marshall.html
(Sorry -- did not see Anton's post  until after I send mine .... 
the old resync bug yet again :)
Joel still posts some interesting reading abut functional languages, 
but as Graham says, he seems to have moved on from REBOL:
http://joelneely.wordpress.com/
Pekr
1-Apr-2009
[13474x2]
We had several good guys vanishing. Andrew Grosman, Adnrew Martin, 
Frank Sievertsen, Volker Nitsch, Romano Paulo Tenca - all skilled 
rebollers.
I am with REBOL since Carl left Viscorp, in 96. I do have early alphas 
- 0.9 something somewhere :-)
Geomol
1-Apr-2009
[13476]
So, to continue my quest to understand ALSO, I'm now at:
1) It's useful to set locals to none in R2 (if done right).
2) It's used to close ports.
3) It's used to change directories back.

And 1) isn't an issue in R3.
Anton
1-Apr-2009
[13477]
4) It's used to avoid a temporary variable.
Gabriele
1-Apr-2009
[13478x3]
Geomol: I never said I do my-port: also... if you need to use a local 
word then you don't need also. I need also all the time.
time-it: func [label code /local s] [
        s: now/precise

        also do code debug/dprobe/label difference now/precise s label
]
to replace TAKE:  also last block remove back tail block
Geomol
1-Apr-2009
[13481x4]
Good examples!
Gabriele, I wasn't very clear with my port example. I didn't mean 
a local word. I'll use your TAKE example. Let's say, we have this 
code:

take: func [block] [also last block remove back tail block]
...
item: take my-block


Have TAKE makes the code smaller, but is it more readable? You have 
to know exactly, what take does, but you have to with many words. 
And is it worth the overhead? Let's compare it to this code, that 
does the same:

item: last my-block
remove back tail my-block


The first version has the overhead of a function call and use of 
ALSO. The last version produce more code, if TAKE is used many times 
through the program. Let's look at a version of TAKE without use 
of ALSO:


take: [block /local item] [item: last block remove back tail block 
item]


This last version has a local word, item. To me, it seems like a 
tricky way to just save a local word. But maybe it's just me, that 
need to see this some more.
Have -> Having
BrianH wrote: "R3 has stack frames, so the entire frame - including 
the locals - is tossed after the function returns."


What is your opinion on this? Is it good or bad to make heavy use 
of the stack? I made some tests, but the picture isn't clear regarding 
performance. One test performed better in R3, another larger test 
performed better en R2.
[unknown: 5]
1-Apr-2009
[13485]
Its superb idea.
Geomol
1-Apr-2009
[13486]
Why?
[unknown: 5]
1-Apr-2009
[13487]
Because their is limited room in the registers and the stack is the 
likely place for those operations.
Geomol
1-Apr-2009
[13488]
How do you think, R2 works?
[unknown: 5]
1-Apr-2009
[13489x2]
I assume it just used the registers and memory without the stack.
Just because Brian seems to be making a distinction.
Anton
1-Apr-2009
[13491]
Geomol, "just save a local word" - this is very useful !  I think 
ALSO just might take a bit of getting used to. It's like many other 
Rebol functions that we are now familiar with and use without thinking 
of its internal variable use. Do you think LOOP and REPEAT should 
not exist because they can be implemented with WHILE and a temporary 
variable? I reckon they are so cool to have in the language, because 
they make the code cleaner.
Geomol
1-Apr-2009
[13492]
Yes, I like LOOP and REPEAT! :-)
BrianH
1-Apr-2009
[13493]
No, R2 doesn't use registers. The context assigned to the function 
is reused, with the value block switched out on recursion. The original 
(non-recursive) value block is left alone when the function returns, 
and set to nones on function entry. This is where the memory leaks 
come from: unintentionally persistent references to local variables. 
R2 actually does have a stack (it's a block), but it is used differently.


R3 just has a second context type that does stack-indirect word dereferencing. 
When the function starts a block of values is pushed on the task-local 
stack and the references to those values do an additional indirection 
to get the stack frame before getting the values - this is why function! 
word dereferencing is 28% slower than object! or closure! word dereferencing.


R2 has two context types: object! and system/words (an expandable 
object!). R3 also has two context types: it doesn't have R2-style 
object! contexts - all are expandable like system/words - but it 
does add the stack-indirect type.
Geomol
1-Apr-2009
[13494]
And a third context type is needed for microthreads?
[unknown: 5]
1-Apr-2009
[13495]
Brian, R3 is using stdcall on windows machines right?
BrianH
1-Apr-2009
[13496x2]
John, I would prefer micro-processes and messaging (like Erlang), 
but there is no third type yet.

Paul, I have no idea, but REBOL function calling doesn't use stdcall 
- it has its own mechanism (to support gc stack frames).
Native code can call REBOL functions, but I don't know how it does 
so, just that it isn't a standard function call.
Geomol
1-Apr-2009
[13498]
>> --1:23
== 0:37

Lexical problem?
ChristianE
1-Apr-2009
[13499x2]
>> +1:-23 
== 0:37
It's parsed as - ( (-1) : (23) )
not too obvious, though
Geomol
1-Apr-2009
[13501x2]
Interesting, thanks!
>> 1:00:-10
== 1:00
Oldes
1-Apr-2009
[13503x2]
Sorry, but it's a known bug which is already fixed in R3:
>> 1:00:-10
** Syntax error: Invalid "time" -- "1:00:-10"
** Near: (line 1) 1:00:-10

** Note: use WHY? for more about this error
imho the first one should be reported in CC and fixed.
Geomol
2-Apr-2009
[13505]
Yeah, --1:23 should be of type url!, shouldn't it?
Gabriele
2-Apr-2009
[13506x2]
Geomol, so you say we should NEVER use functions? Inlive everything? 
One single block of code?
*Inline
Geomol
2-Apr-2009
[13508x2]
Of course not. I just try to figure out, what ALSO is, and how I 
can use it. Some of my comments are to figure out, if it's worth 
it.
And I'm concerned about complexity (like Carl blogged about lately). 
I don't want REBOL to go down the complex road. There are so many 
examples, where that will lead to. To me, one word less can be a 
good thing, but it depends, if it's really needed.