[REBOL] Re: To do or not to do?
From: rotenca:telvia:it at: 29-Nov-2001 17:22
Hi Ladislav,
> Although my Convert-word function (can be found in
> http://www.sweb.cz/LMecir/contexts.html ) does preserve the context when it
> converts a word to another datatype, I would prefer a refinement for the To
I know. The limit is bind which does not bind to any but word! datatype!
I do not understand why RT have not made bind more general (any-word!)
If the starting word was [:z] noone can convert it to set-word/word/lit-word
while preserving binding. It is a bad hole in Rebol.
> function like (to/context set-word! something).
What i do not understand is why 'to does not preserve binding. I understand
that some values passed to to-word have not an original binding, like string,
and that only the global context can be extended. But i think that is
difficult to remember that code like this:
a: 50
use [a] [
a: 3
print :a
print get to-get-word 'a
]
gives as result
3
50
It can generate subtle and difficult-to-catch error.
Your /context should return an error if the word is not already defined in the
context - this should be true also for global context. For ortogonality and
block contexts (use/func) i think that the sintax should be:
to/context set-word! 'word-in-a-context
like with bind (and an implicit bind is exactly what we want).
---
Ciao
Romano