[REBOL] Re: what to do with bind ?
From: rebol665:ifrance at: 25-Nov-2001 18:06
Hi, ladislav
The first time I found 'bind was in some of your code. But I wonder if
'bind is only useful for those who explore the guts of Rebol. I'm looking
for an example that enlighten the use of bind in a simple way. I thank
Andrew Martin for his help, but ML.r is far too complex for me. Comme on dit
chez nous "ce qui se conçoit bien s'énonce clairement".
Searching for the light, I found Ingo Hohmann's TUI Dialect article on
Rebol-Force site. I thought it was it, because he was using 'bind in a way
that was logical to me (to avoid an error). I have experimented his code and
to my surprise and disbelief I have found that the program works fine with
or without 'bind .
So I'm more puzzled than ever. This is the code I extract from Ingo article.
It should give an error because screen-size is not in the same context but
it did not.
What is wrong with it ?
Rebol [ title: "test"
purpose: "what to do with bind?"]
cursor2: func [
{Cursor positioning dialect (iho)}
commands [block!]
/local rules string arg
][
; Don't forget to add 'screen-size to our functions locals
screen-size: (
c: open/binary/no-wait [scheme: 'console]
prin "^(1B)[7n"
arg: next next to-string copy c
close c
arg: parse/all arg ";R"
forall arg [change arg to-integer first arg]
arg: to-pair head arg
)
string: copy ""
commands: compose commands ; NEW LINE HERE
rules: [
any [
'clear (append string "^(1B)[J") |
'at set arg pair! (append string rejoin ["^(1B)[" arg/x ";"
arg/y "H"]) |
set cnt integer! set arg string! (
append string head insert/dup copy "" arg cnt
) |
set arg string! (append string arg)
]
]
parse commands rules
string
]
print cursor2 [clear at 1x10 (screen-size/y / 2) "x"]
print cursor2 [at 2x10 "no bind but no error too"]
halt