• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r4wp

[Rebol School] REBOL School

Sujoy
11-Oct-2012
[1322x5]
works perfectly with 2.1.4
havent been looking at changes to zmq for a while now
but all of my python stuff works just fine with 3.2
AND i have pub-sub working between r2 and python
2.1.4 on r2, 3.2 on python
Kaj
11-Oct-2012
[1327x2]
They made some awkward changes in the 3 series that I haven't reviewed 
yet
I'll probably switch to Crossroads I/O
Sujoy
11-Oct-2012
[1329]
hmmm - dont know that one
checking it out now...
Kaj
11-Oct-2012
[1330]
Fork by the original developers
Gregg
11-Oct-2012
[1331]
SUjoy, send me a reminder next week. I'm very busy the next few days, 
but have ported many of the 0mq guide examples. Mine use Andreas's 
binding, but it might still help.
Sujoy
11-Oct-2012
[1332]
Will do Greg...I saw on the zmq list that you were doing the peering 
example as well...super stuff
Kaj
11-Oct-2012
[1333x3]
Found the underlying problem: I had the push/pull definitions the 
wrong way around
Fixed it and added the complete ventilator example:
http://rebol.esperconsultancy.nl/REBOL-2-ZeroMQ-binding
Sujoy
11-Oct-2012
[1336x2]
:)
i should have been able to pick that out
thanks kaj...downloading now
Kaj
11-Oct-2012
[1338]
I only realised at the end, when no other possibility remained :-)
Sujoy
11-Oct-2012
[1339]
working with zmq3.2? i'm wondering if i should download and move 
up to 3.2
...though crossroads i/o looks very good
Kaj
11-Oct-2012
[1340]
Better wait, I haven't adapted to 3.2 yet
Sujoy
11-Oct-2012
[1341]
ok. thanks again Kaj
Gregg
11-Oct-2012
[1342]
I haven't followed crossroads too much. Is their i/o very different?
Sujoy
11-Oct-2012
[1343x3]
very similar from what little i've seen
they even have a libzmq compatability layer built in
only supports zmq 2.1.1 though
and will be deprecated
Gregg
11-Oct-2012
[1346]
That makes sense. Forks happen.
MarcS
12-Oct-2012
[1347]
I see that some folks use 'copy' on top-level bindings (i.e., foo: 
copy [], bar: copy "", bas: copy #{}). Is this simply stylistic (for 
consistency with initialisation inside of blocks) or am I overlooking 
a potential pitfall?
Henrik
12-Oct-2012
[1348x3]
The pitfall is the copy trap.
and the copy trap may occur anywhere.
http://www.rebol.net/wiki/Forgoing_faux_pas#The_COPY_Trap
MarcS
12-Oct-2012
[1351x6]
sure, but that example is inside a block
( f: has [t] [t: [] append t 1] )
i'm asking why (if) i should do:
rebol [] foo: copy []
instead of
rebol [] foo: []
Henrik
12-Oct-2012
[1357x2]
it does not matter. it occurs anywhere.
If you use foo: [], you can.


There are perfectly legitimate ways to use the block that way. You 
should simply be aware of this fact, when assigning the word to that 
block.
MarcS
12-Oct-2012
[1359x4]
so is there any reason for using copy at the top level (global assignments) 
with binding to literals?
(i.e., i'm asking about 'foo: [1 2 3]' rather than 'bar: [1 2 3] 
foo: copy bar')
i guess a related question is whether i'll run into difficulties 
with 'context [ foo: [] ]' versus 'context [ foo: copy [] ]'
(typo: 'with binding' should read 'when binding')
Henrik
12-Oct-2012
[1363x3]
that again depends on how the word is meant to be used. if you use 
the context as a copyable prototype, then the original 'foo block 
will be re-used, if you don't copy it on creation of the context.
at the top level, there may not be a reason, but through various 
tricks, it's still possible that it may be relevant to copy it, such 
as if the code itself is later used in a context, which means the 
code is no longer top level.
if you don't copy it on creation of the context.

 => "if you don't copy it on creation of each new copy of the original 
 context."
MarcS
12-Oct-2012
[1366x3]
hmm
maybe i'm misunderstanding your clarification, but i don't see any 
difference between copying the literal block: http://pastebin.com/L2Qx4djY
oops, 'when copying the literal block'* (sorry for all the typos)
Henrik
12-Oct-2012
[1369x2]
hmm... I clearly remember it being not copied, but I seem to be wrong 
about that.
aha, it's the case for contexts inside contexts.
Ladislav
12-Oct-2012
[1371]
so is there any reason for using copy at the top level (global assignments) 
with binding to literals?
 - certainly, there are reasons. See these two examples:

; example #1
repeat i 2 [
    a: []
    append a i
    print mold a
]

and

; example #2
repeat i 2 [
    a: copy []
    append a i
    print mold a
]