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

World: r3wp

[Core] Discuss core issues

Geomol
1-Apr-2009
[13484]
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
[13523x2]
now where did I put my Lava alphas ... ;-)
I wish I knew the best way to install a Core script as a "service" 
(service in the Windoze sense so it has a specific login rights, 
which map up to a UNC share rights)
[unknown: 5]
2-Apr-2009
[13525]
http://softinnov.org/rebol/nt-services.shtml
eFishAnt
2-Apr-2009
[13526]
Ask, and you shall receive.  Knock and the door will be opened.  
Thanks, Paul!
[unknown: 5]
2-Apr-2009
[13527]
Your welcome - thank Doc for the work on that.
eFishAnt
2-Apr-2009
[13528]
I was going to thank God, but Doc will do.
[unknown: 5]
2-Apr-2009
[13529]
Thanks them both!
Geomol
4-Apr-2009
[13530]
I wrote: " --1:23 should be of type url!, shouldn't it?"

Actually, it's not a valid url according to the definition:
http://en.wikipedia.org/wiki/URI_scheme

The scheme name consists of a letter followed by any combination 
of letters, digits, and the plus (

+"), period ("."), or hyphen ("-") characters; and is terminated 
by a colon (":")."

So it should probably just be an invalid time.
Janko
4-Apr-2009
[13531]
in R2.. can the object ( via make object! ) know the name ot itself 
somehow?
Gregg
4-Apr-2009
[13532]
Only if you add it as a field yourself.
Geomol
4-Apr-2009
[13533]
An object can refer to itself with SELF, like:
o: make object! [a: 1 b: self/a]
(maybe not a very useful example.)