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

World: r4wp

[Rebol School] REBOL School

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
]
MarcS
12-Oct-2012
[1372]
ladislav: i meant when not binding inside a block
Ladislav
12-Oct-2012
[1373x2]
What does it have in common with "binding"?
BTW, the examples both use binding in a way
MarcS
12-Oct-2012
[1375]
i just mean assigment
Ladislav
12-Oct-2012
[1376]
actually, you cannot use assignment "outside of a block" in REBOL
MarcS
12-Oct-2012
[1377]
henrik: but - http://pastebin.com/3s30AxY4
Ladislav
12-Oct-2012
[1378]
(there is always a block somewhere)
MarcS
12-Oct-2012
[1379x2]
ladislav: sorry, i'm using terminology sloppily
i guess: assigning to a word in the global (system?) context
Ladislav
12-Oct-2012
[1381]
that is what both the examples above do