* Andreas Bolka <[EMAIL PROTECTED]> [040121 09:06]:
>
>
> I will spare you my thoughts about REBOL's contexts and 'bind (for
> now) but I have a practical question:
>
> What is the utility of 'bind? No, I don't necessarily mean the typical
> cases where bind is needed to prevent errors. What I'm really thinking
> about are situations, where REBOL's behaviour regarding contexts and
> bind is actually contributing towards an elegant solution for a real
> problem.
>
> I think I remember various parse-based solutions posted to the list,
> that utilized bind. This is basically a question to those who
> understand _and_ use 'bind to actually solve problems: What do you use
> it for? Do you think REBOL's behaviour in those regards is practical?
> Are you aware of elegant solutions based on 'bind?
Although there are python-esque ways of doing things and rebol-esque
ways of doing things, I find the two languages inform me of further
possibilites.
Every python object has a built-in method called __dict__ (as far
as I know).
If you pass to a python object a series of keywords, you can validate
such keywords against __dict__
A rough comparison would be a rebol subroutine like this:
__dict__: does[next first self]
and if one had an object method - called 'set for instance.
that looked like this:
set: func[arg[block!]][do bind arg 'self ]
a validation routine within the context could then test for
the previous existance of a word using self/__dict__
; untested code!
context.....[
validate: func[args[block!] /local keywords][
keywords: self/__dict__
foreach [arg value] args[
if not find keywords arg[
throw-an-error
]
]
]
]
and one could have an object-creation routine that would guarantee
that an object be created with certain builtin methods, such as those
above.
*****************************
* Who says rebol ain't OOP! *
*****************************
> that utilized bind. This is basically a question to those who
> understand _and_ use 'bind to actually solve problems: What do you use
Now, to put my money where my mouth is, I need to implement this!
tj
--
Tim Johnson <[EMAIL PROTECTED]>
http://www.alaska-internet-solutions.com
--
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.