[REBOL] WYSIWYG programming
From: lmecir:geocities at: 4-Nov-2000 8:31
Hi,
Holger Kruse tried to explain his notion of what is legal/defined in Rebol:
...
> > a: [append a [+ 1] 1]
>
> The above expression modifies a block while it is being evaluated. AFAICT
at
> this time the result of such an operation should be considered "undefined"
and
> "implementation-dependent". In other words: don't do that !
....
> A "legal" way to rewrite the above REBOL expression would, e.g., be:
>
> a: [append last a [+ 1] do [1]]
>
> This way the main block does not get changed during evaluation. Only the
> block referenced from the main block (the one initialized to be [1]) gets
> changed. That is completely legal.
>
> I hope you can see now why I dislike the term "self-modifying code". There
is
> conceptually a huge difference between the first and second example, and
> the term "self-modifying code" tries to be a catch-all phrase that
encompasses
> (and discourages) within the same category both legal (and potentially
useful)
> and illegal practices.
>
> --
> Holger Kruse
> [holger--rebol--com]
Here is my example of a non-WYSIWYG code modifying a sub-block:
l: 30
f: does [l: l - 1 insert back tail last second :f [+ 1] if l > 0 [f print
1]]
the result:
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
15
14
14
14
14
14
14
14
7
6
5
4
3
2
Moreover, I realize, that my definition of WYSIWYG Code needs some
polishing...
Regards
Ladislav