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
----- Original Message -----
From: "Ladislav Mecir" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, November 24, 2001 10:54 PM
Subject: [REBOL] Re: what to do with bind ?
> Hi Patrick,
>
> 1) e.g. I used Bind in http://www.sweb.cz/LMecir/highfun.r
> (twice), although it could have been done without Bind too.
>
> 2) if you can do something with Bind and you know the context of the
> Known-word argument, then there usually is a (slower and more complicated)
> way how to write things without Bind (this is the case of most dialects,
> e.g. Andrew could have written his dialect even without knowing the Bind
> function). If you explore unknown contexts or inaccessible contexts such
as
> e.g. function contexts, you may not be able to write your code without
Bind.
> For example the In-object? function or the S-c? function couldn't have
been
> written without Bind (IMO).
>
> Cheers
> Ladislav
>
> Hi,
>
> I am wondering what is the purpose of bind. I have read the doc and also
> interesting code where bind is used (for example Ladislav s-c? function).
My
> question is more why is there a bind function than what does bind do. Or
put
> in another way what would be impossible (or very difficult) to do without
> bind ?
>
> Patrick
>
>
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.
>
______________________________________________________________________________
ifrance.com, l'email gratuit le plus complet de l'Internet !
vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP...
http://www.ifrance.com/_reloc/email.emailif
--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.