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

World: r3wp

[!REBOL3-OLD1]

Rebolek
11-Feb-2009
[10985]
the change is that -1 from R2 is now 0. This is logical imo.
Pekr
11-Feb-2009
[10986]
Rebolek - the thing is, that with REBOL, there is no 0th position.
Henrik
11-Feb-2009
[10987]
But there is in math.
Rebolek
11-Feb-2009
[10988]
the indexes in R2 were ...-3,-2,-1,1,2,3... now it's -3,-2,-,1,0,1,2,3
Henrik
11-Feb-2009
[10989x2]
When zero is added, the math for calculating offsets becomes simpler. 
Less code.
(but this is not zero-based indexing. it's not the same thing.)
Pekr
11-Feb-2009
[10991]
I have to think and come up with example, when you use index? something, 
to get your position, I think that then the change shifts the calculation 
in such a case...
Rebolek
11-Feb-2009
[10992]
Exactly, Henrik.
Henrik
11-Feb-2009
[10993x2]
Pekr, I don't know if it makes a difference, because INDEX? seems 
to be used only on positive values. Can INDEX? return negative values?
From what I see here, it can't, so it won't make a difference.
Pekr
11-Feb-2009
[10995x4]
I remember, in the past, to use index? heavily. But back then something 
like blk/:value was not possible. Can't find any example or use case 
where it could fail ... so it might mean, that current behaviour 
will not harm any code ...
btw - one question - in above Rebolek's example - why when we reassing 
(reference) a block ('b in his example), index? refers to original 
block, whereas functions like 'length? behave locally to new referenced 
block? Just a question :-)
... is it just because it is usefull this way, even if not consistent?
'b is a block! type, so no excuse here that it just "points to original 
block at certain position" applies here :-)
Henrik
11-Feb-2009
[10999x3]
It's perfectly consistent and useful for subblocks. If INDEX? was 
local to the block in use, a lot of things wouldn't be possible.
You would not be able to recall the position of the subblock. You 
would have to recalculate it every time.
If you want index to be zero, copy the block.
BrianH
11-Feb-2009
[11002x2]
Petr, I have been proposing that new PICKZ and POKEZ functions be 
added to do a 0-based PICK/POKE, instead of having vector! be 0-based. 
This would give us 0-based referencing abilities for all series, 
not just vectors, then we could make vectors 1-based like the rest. 
There are real advantages to 0-based indexing so it would be good 
to have it, but consistency is better here.


Carl was not proposing to make a change to PICK and POKE in his blog: 
he already (half) made the change. He was asking us in his blog if 
he should change it  *back* to the old, buggy R2 behavior. I think 
he should finish fixing PICK, POKE and AT instead.


Henrik, INDEX? returns a 1-based index from the *head* of the series 
- that's why it's always positive.
Indexes are calculated by adding the base to the offset. The new 
behavior for PICK and POKE makes that consistent, though AT should 
be fixed as well as it is the only index-based native left (unless 
I've forgotten something). I've added bug tickets for all of this.
Pekr
11-Feb-2009
[11004]
OK, thanks for explanation.
BrianH
11-Feb-2009
[11005]
Personally I prefer 0-based indexing since it's more useful and less 
confusing, but we are stuck with 1-based.
sqlab
11-Feb-2009
[11006]
Is there a way to control/stop a task by the calling process or shall 
the called task check a semaphore set by the calling process?
BrianH
11-Feb-2009
[11007]
In R3? Tasks don't really work yet, and we may be changing the model. 
Aside from that, I don't know.
sqlab
11-Feb-2009
[11008]
then I hope the final implementation will get something like freeze 
and kill
BrianH
11-Feb-2009
[11009]
Tasks are really up in the air, especially since threads are being 
considered to be a bad model nowadays in the multitasking community. 
It would be good for REBOL to start with a good model now, before 
it becomes too late to change later. Maybe green processes like Erlang 
:)
sqlab
11-Feb-2009
[11010]
whatever model gets chosen, some control would be good.
TomBon
11-Feb-2009
[11011]
erlangs concurrency model, hot code loading, easy process communication, 
robust message passing 

and a nice database (let's call it rebnesia)...all ported to our 
fabulous rebol.
...when did you said you are ready with this brian? :-))
Pekr
11-Feb-2009
[11012]
BrianH - weren't threads choosed because processors better optimise 
them?
BrianH
11-Feb-2009
[11013]
Pekr, threads were chosen because the multi-core processor increase 
hadn't started yet when the initial task! model was created. Processors 
don't optimize threads better than green processes, or even regular 
processes on Linux. Windows regular processes are pretty heavy but 
Windows 7 is implementing green processes right in the OS. That doesn't 
mean Erlang would need to use them though.
Janko
11-Feb-2009
[11014]
I think special thing about erlang is that each green process has 
very very little memory overhead (just 16-32 words) that is why there 
can be soo many of processes and that it can switch between them 
very fast. I imagine Erlang vm spreads N green processes on some 
number of native threads/processes (but I am not sure)... Another 
interesting language to look in this regards is stackless python
Gregg
12-Feb-2009
[11015]
Maarten? Calling Maarten. Erlang is being discussed. :-)
Maarten
12-Feb-2009
[11016]
Erlang uses their own lightweight process implementation (like you 
could write in REBOL .... hint); remember that the first version 
were written in Prolog. The Erlang VM uses all cores on a machine. 
The "no shared memory" aprroach makes this easy.


R3 should be able to utilize multiple cores. Then with async networking 
and people finally understanding dialecting who needs tasks? Just 
roll your own.
Pekr
12-Feb-2009
[11017x2]
Maarten - could you please explain your "who needs tasks" remark? 
You need some low level support, to be async, no? And by async I 
don't think only networking ....
IIRC, in R3, processes (threads) were not planned to share memory. 
ipc scheme was supposed to be provided ...
BrianH
12-Feb-2009
[11019]
He might mean "who needs threads?", because "tasks" aren't defined 
yet. As Erlang proves, there are advantages to having both green 
processes and full processes, especially if they are basically interchangeable 
as far as the code running in them is concerned. You *could* just 
go with full processes like R2 does ("Just roll your own."), but 
that wouldn't be as efficient as a hybrid green/full approach, particularly 
on platforms like Windows that have huge creation and switching overhead 
for full processes.
Henrik
12-Feb-2009
[11020]
Having to roll our own would be very cumbersome. It might be simple 
for Maarten who has written threading engines for R2, but for us 
lesser ones, it would be handy, if it was built in. I consider not 
having it a showstopper in many cases. AFAIR, threading was the original 
reason for starting R3 development?
BrianH
12-Feb-2009
[11021x2]
No, it was the broken port model.
Henrik, everyone who can, please get into R3 chat and read messages 
#1786 and #1436. I need help.
Henrik
12-Feb-2009
[11023]
Nail-biting, hair-loss inducing reply posted. :-)
Graham
12-Feb-2009
[11024]
Hope we get a GUI for R3 chat soon ... I find it just too hard to 
read it in a console.
[unknown: 5]
12-Feb-2009
[11025x2]
One formatting fix they need to make for RebDev is to put a blank 
line as the first input of each post.  Makes it a bit more readable.
Also, maybe add an R options to automatically have the message prefixed 
with a REPLY to #XXXX where x is the message number.
Henrik
12-Feb-2009
[11027]
Paul, the R option exists and works like you specify.
[unknown: 5]
12-Feb-2009
[11028x2]
Ahhh, that must mean that me and the Great mind of Carl think alike. 
 ;-)
I'm still a noob to RebDev.
BrianH
12-Feb-2009
[11030x2]
I'd be happy if they had word-wrap, as I've been manually word-wrapping 
my own posts.
Reply to your nail-biter Henrik: #1789.
[unknown: 5]
12-Feb-2009
[11032]
I thought Henrik's R3 GUI skills would have manufactured a GUI for 
RebDev by now.
BrianH
12-Feb-2009
[11033]
R3's GUI is missing some necessary styles for a RebDev client, notably 
grids. Filling in the blanks needs more programmers, so we are focussing 
on getting the file management portions of DevBase integrated first 
so we can get other people involved in the process. Priorities :(
Henrik
12-Feb-2009
[11034]
Also I'm pressed for time for about another month.