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

World: r3wp

[Core] Discuss core issues

Graham
31-Mar-2009
[13436x3]
not using external libraries
I was posting the data to a web server
web service
Anton
31-Mar-2009
[13439]
That was a memory leak, not really caused by the "local vars not 
unset on R2 function exit" behaviour. (But perhaps contributed, by 
misunderstanding, to the leak bug.)
[unknown: 5]
31-Mar-2009
[13440]
Yes, Graham we need to clear those locals by setting them to none.
BrianH
31-Mar-2009
[13441]
I use ASLO in R2-Forward for that reason - that was the original 
reason ALSO was suggested. You don't need ALSO for that in R3 since 
the locals unset themselves in the new function context model, but 
it is useful for closing ports and changing directories back.
[unknown: 5]
31-Mar-2009
[13442]
Brian, are the parameters in R3 also unset in R3?
BrianH
31-Mar-2009
[13443x3]
R3 has stack frames, so the entire frame - including the locals - 
is tossed after the function returns.
Closures are different though - a whole new context is created with 
each call, words and values both.
Closures are for doing "memory leaks" on purpose :)
[unknown: 5]
31-Mar-2009
[13446]
Will we get any control over the stack?  So that we can potentially 
perform recursive operations without overflow?
BrianH
31-Mar-2009
[13447x2]
Unlikely, since most tail recursion optimizations require an optimizer, 
or at least a compiler. Manual access to the stack is a security 
hole (unless the language is Cat). Accept that REBOL has real loops 
and that imperative programming is more efficient in an interpreted 
language :)
REBOL was designed to be interpreted efficiently. Don't compare it 
to languages that were designed to be compiled (like Haskell) or 
languages that aren't designed for efficiency (like Scheme).
[unknown: 5]
31-Mar-2009
[13449]
Yeah I understand that.
BrianH
31-Mar-2009
[13450x2]
REBOL 1 had tail-recursion optimizarion. REBOL 2 got rid of it on 
purpose, and got 30 times faster as a result :)
There were some other tricks that contributed, like getting rid of 
continuations and ELSE.
[unknown: 5]
31-Mar-2009
[13452]
Carl sharing this much with you or how do you know this about REBOL?
BrianH
31-Mar-2009
[13453]
I was one of the beta testers of REBOL 2 - I've been around that 
long :)
[unknown: 5]
31-Mar-2009
[13454x2]
I can't remember what version I started with REBOL in.  I just know 
the year was 98.
But I walked a way a bit at times as the lack of development waned.
BrianH
31-Mar-2009
[13456]
Earlier than me - I started in 99, with REBOL 1.0.3.
[unknown: 5]
31-Mar-2009
[13457]
I remember back then we had Holger, Jeff, and Sterling.
BrianH
31-Mar-2009
[13458]
I miss those guys. The beta list for R2 started a month after I arrived.
[unknown: 5]
31-Mar-2009
[13459]
Yeah I found out about REBOL through a listserv I was on at the time 
with a bunch of Cisco Engineers.
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.