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

World: r3wp

[Core] Discuss core issues

BenBran
16-Jan-2009
[12082x2]
Yes this helped thank you.
I'll look some more later, but what seemed to fix it was the built 
in function 'to-rebol file'  :-)
Janko
19-Jan-2009
[12084]
can I ask if you know any other options for rebol to talk to other 
independant processes on linux? For example could I use something 
like named pipes?
Chris
19-Jan-2009
[12085x2]
There was a script for Rebol->Arexx once called Pipebridge.  Wonder 
if it's applicable to Linux?
Rebol<->Arexx
btiffin
19-Jan-2009
[12087]
Janko; I'm pretty sure a mkfifo named pipe will work; BUT as usual, 
either end borks, the other end hangs.
Janko
19-Jan-2009
[12088x4]
Chris: I googled about what you said but didn't find any source, 
but interesting.. this stuff was running on amiga at the time :)
btiffin: I am newbie at linux... you mean I can make a named pipe 
in command line with mkfifo and then rebol uses that as a normal 
filename to write/read from it? Similarly the other language has 
Unix package and can make named pipes by it's own... can rebol create 
pipe too? (sorry if I got it all wrong)
about hanging, yes I read that write does not happen untill there 
is a read at the other side and vice versa so I was thinking if there 
is some king of timeout possible..
hm.. but why is it then called fifo if read needs to happen at the 
same time as write, I thought it's some sort of fifo (first in first 
out) stack/queue
btiffin
19-Jan-2009
[12092]
Well normally fifo files are created in blocking mode, so yeah a 
write won't complete until a read occurs and a read will wait for 
a writer (by default).  I'll be honest, I've not done this from REBOL, 
but with 2.7.6 and LOAD/LIBRARY freed, we can do any libc6 calls 
that we want, so you should be able to set a non blocking mode and 
get true multiple writes and reads that will return empty if no data 
is queued.


For OpenCOBOL I implemented POSIX Message Queues; as MQ_NOTIFY will 
make a callback when the queue goes from empty to non-empty and you 
don't have to worry about spinning on a read.


If you don't mind playing with  make routine!  take a look at mq_open 
and friends (man mq_overview) it might offer more control for IPC.
Janko
20-Jan-2009
[12093x2]
thanks btiffin for such great explanation, yes I was looking at message 
queues too at first but then someone proposed pipes and they do seem 
more accessible/simple to start in a way.
Is there any article or blog post about 2.7.6 being able to load 
native libraries? I searched and couldn't find any info on this.. 
I found docs for REBOL/Command/SDK version so this would be a place 
to start experimenting probably
btiffin
20-Jan-2009
[12095]
Janko; yep.  It's weird, docs wise, but  make routine!  is a new 
bonus layer that hasn't made it's way to the main documentation. 
 Our good Gregg is a goto guy when it comes to knowing some of the 
foibles invovled.  If you like learning by example http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=capture-screen.r
or http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=capture-screen.r
  There are other examples.
Janko
20-Jan-2009
[12096]
great, I love learning by example :) .. btw .. both of your links 
are the same I think
btiffin
20-Jan-2009
[12097]
Sorry Janko;  the second was supposed to be http://www.rebol.org/view-script.r?script=sqlite3-protocol.r
  that's what I get for not reading what I'm writing.
Janko
20-Jan-2009
[12098x2]
oh, great just what I need... I was fixing/modding a sqlite binding 
in factor already
so I can compare a little , and I will probably need it also
[unknown: 5]
21-Jan-2009
[12100x2]
>> a: copy []
== []
>> b: 'test
== test
>> append a :b
== [test]
>> type? first a
== word!
>> find a 'test
== [test]
>> c: ['test]
== ['test]
>> find a first c
== none
That just bothers me.
Pekr
21-Jan-2009
[12102]
type? first ['test]
== lit-word!
[unknown: 5]
21-Jan-2009
[12103x5]
Yes I know.
My point is that REBOL is not consistent.
Why can I do a find using a lit-word but not get results when using 
the lit word from a block?
find a 'test works but find a first c doesnt.
I would have to use find a to-word first c to get a match.
Pekr
21-Jan-2009
[12108x3]
I think it is a bug. But we will probably see gurus trying to find 
an excuse, why sometimes you can't code in REBOL different way than 
to simply try some stuff in console ...
And - imo if RT would post some formal specification to the language, 
we could fix some gotchas and surprises, not trying to find academic 
theories, why it work certain way ...
insert as an operation does not preserve datatype. It reduces litword 
to word. Not sure there is a reason to do so ...
[unknown: 5]
21-Jan-2009
[12111]
Yeah, that to me would be a bug.
Henrik
21-Jan-2009
[12112]
>> append [] to-lit-word 'a
== ['a]
[unknown: 5]
21-Jan-2009
[12113x2]
Yeah Henrik but that is a workaround really.
the 'a was already a lit-word to begin with.
Pekr
21-Jan-2009
[12115x2]
Henrik - but - that is exactly the excuse I was talking about
why should I use to-whatever for one datatype, but not for the other 
one?
Henrik
21-Jan-2009
[12117x2]
the question is probably which operation is more common.
I'd bet Carl did it that way, because it is something he does more, 
than the other way around.
Pekr
21-Jan-2009
[12119]
hmm, but it can really lead to surprises, as Paul got - trying to 
find something by reference ....
[unknown: 5]
21-Jan-2009
[12120]
To me it is one of the exceptions to the rule things.  With REBOL 
you gotta have all these exceptions to the rule.
Henrik
21-Jan-2009
[12121]
I'm not defending it, just trying to come up with a theory.
Pekr
21-Jan-2009
[12122]
... but yes, REBOL is dynamic, so it might be a problem, to have 
all cases working as expected ...
[unknown: 5]
21-Jan-2009
[12123]
lol
Henrik
21-Jan-2009
[12124]
because I know that Carl works alot more with cases of usage rather 
than theoretical correctness, as long as the result isn't completely 
backwards/illogical.
[unknown: 5]
21-Jan-2009
[12125]
Well, at least I know how to get around it which is why I just mentioned 
that it "bothers me".
Pekr
21-Jan-2009
[12126]
Now someone clever should answer, if it would have some consequences 
to not reduce lit-word upon block insertion?
[unknown: 5]
21-Jan-2009
[12127]
But to me Henrik the append or insert should be able to look at the 
argument and see it is already a lit-word and append it as such.
Henrik
21-Jan-2009
[12128x2]
I was going to write something clever about that, but I think trying 
to fit such a change in has some pretty big ramifications for how 
words are used in REBOL. :-)
anyhoo, I can't defend it, so I'll let BrianH take over.
[unknown: 5]
21-Jan-2009
[12130x2]
Heh.
Well at least you didn't try to give excuses.