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

World: r3wp

[Core] Discuss core issues

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.
Steeve
2-Apr-2009
[13510]
what is complex is your aim :-)
Geomol
2-Apr-2009
[13511]
I'm a tool maker. I want my tools to be simple and functionel.
Steeve
2-Apr-2009
[13512]
Who doesn't want ?
Geomol
2-Apr-2009
[13513]
Eh, most of the developers in the world, it seems? ;-)
eFishAnt
2-Apr-2009
[13514x2]
Note that the UNC with core works perfect.  Better than Windoze console 
on a Windoze server!  Kudo's to Carl for integrating repulsive technology 
with a beautiful console!  Windows  cmd does not let you cd to the 
UNC drive!
...but I can change-dir to the UNC drive inside REBOL/Core's console.
Maxim
2-Apr-2009
[13516]
unc root... wow!
Izkata
2-Apr-2009
[13517x2]
So, question.  I know rebol has difference, intersect, and union 
- but is there a subtract for sets built in?
I know "difference a intersect a b" works, just wondering, though..
Maxim
2-Apr-2009
[13519]
>> help exclude
USAGE:
    EXCLUDE set1 set2 /case /skip size

DESCRIPTION:
     Return the first set less the second set.
     EXCLUDE is a native value.

ARGUMENTS:
     set1 -- First data set (Type: series bitset)
     set2 -- Second data set (Type: series bitset)

REFINEMENTS:
     /case -- Uses case-sensitive comparison.
     /skip -- Treat the series as records of fixed size
         size -- (Type: integer)
Izkata
2-Apr-2009
[13520]
Thankies, never saw the name before
Maxim
2-Apr-2009
[13521x2]
:-) rebol stays fresh for YEARS.  I've been using it since the betas 
for first view, and I still discover new things now and then.  :-)
(sorry v1 core betas :-)
eFishAnt
2-Apr-2009
[13523]
now where did I put my Lava alphas ... ;-)