Stupid function contexts (or stupid Rebol user?)
[1/5] from: d4marcus:dtek:chalmers:se at: 5-Dec-2001 22:00
Hi,
For probably the hundredth time, I have stumbled over the problem with
function contexts, or however you would call it.
It's the usual problem: There's an object, containing a bunch of parse
rules and a function. The parse rules make use of same words that are
local to the function. This doesn't work of course.
Solution 1 (bad): Put all the parse rules in the function, which means
they are redefined every time the function is executed.
Solution 2 (worse): Put all words in the object, which mean the function
can only be called once at a time, i.e. it must finish until it can be
called again, since some words can't be shared. This makes using it with
several faces at once impossible.
Solution 3 (good): Insert you suggestion here, please. :-)
Btw, does anyone have a decent standalone presentation script? Something
using simple colored named boxes, which you can connect your own docs
presented in a similar fashion to the easy-draw doc (a full MDP-to-VID
converter would be nicer still). I have thrown together one which almost
does what I want, except that it doesn't quite work because of the problem
above, and besides it's not general at all. A dialect for building this
kind of presentation would come useful.
Marcus
------------------------------------
If you find that life spits on you
calm down and pretend it's raining
[2/5] from: arolls::idatam::com::au at: 6-Dec-2001 14:12
> Solution 1 (bad): Put all the parse rules in the function,
> which means
> they are redefined every time the function is executed.
I don't think they are.
Anton.
[3/5] from: d4marcus:dtek:chalmers:se at: 7-Dec-2001 23:34
On Thu, 6 Dec 2001, Anton Rolls wrote:
> > Solution 1 (bad): Put all the parse rules in the function,
> > which means
> > they are redefined every time the function is executed.
>
> I don't think they are.
Ah, right. The blocks remain the same, and are just rebound to the words
every time. Obviously it's not a speed problem. I just want to keep the
rules outside the function to make it more readable.
Anyway, it's not that important. Either I figure something out, or I will
make a habit of putting the parse rules inside the function. But it would
be cool to be able to bind a block to a function context.
Marcus
------------------------------------
If you find that life spits on you
calm down and pretend it's raining
[4/5] from: ammonjohnson:ya:hoo at: 7-Dec-2001 18:22
Hm.. you seem quite bleak in question here. would you mind giving us an
example where you_need_a word in the function to be the same spelling as a
word that refers to a parse rule?
Thanks!!
Ammon
[5/5] from: lmecir:mbox:vol:cz at: 8-Dec-2001 9:27
Hi Marcus,
<<Marcus>>
(...)
But it would be cool to be able to bind a block to a function context.
Marcus
(...)
<</Marcus>>
That *is* possible. I used such a trick in my latest implementation of the
REFINED function in %highfun.r OTOH, I think that in the case of Parse rules
it might be an overkill...
Cheers
Ladislav