Hi, Bob!

Elan beat me to the punch with a good illustration of the first
technique I thought of (I'm just recovering from a big deadline
and a recurrence of something like bronchitis, so I'm WAY behind
on my emails...)

However, I'd like to offer a meta-response.  (I'm sure you're
already familiar with the point I'll make; I'm just throwing it
out to the list for general discussion.)

I've faced questions of the form

    "What in language X corresponds to the foo feature
     of language Y?"

in a variety of settings over the years (both in "real-world"
software development and in teaching comparative programming
languages courses).  I've found it interesting (and useful) to
respond with the question, "Why do you want to do that?"

Sometimes the questioner actually wants to accomplish a given
result, and Y/foo was the only (or first) way that came to mind.
On occasion, understanding the intended usage helped me either
to give a better answer (TMTOWTDI) or explain X better.

So...  my response would have included code roughly equivalent to
(and I hope as nicely presented as) Elan's response, but I would
have include remarks something like

    Often dynamic scoping gets used as a way to provide
    "hidden arguments" to a function without the coding
    effort (or possible r/t overhead) of explicitly
    passing them as parameters.

    One way to get around this (and to reduce the consequent
    side-effect dependence and subtle bug opportunities) is
    to restructure the code so that all arguments are
    explicitly passed, instead of hidden in modifications to
    a global environment.

Would this sort of additional commentary be of value?

[EMAIL PROTECTED] wrote:
> 
> Hi Bob,
> 
  ...
> The script:
> 
> n1: 1
> 
> readFile: func [ name ] [
>   if a1 [
>     use [n1] [
>       n1: 300
>       doincl name n1
>     ]
>   ]
>   doincl name n1
> ]
> 
> doincl: func [name n1] [
>   print ["includelevel:" n1 name]
> ]
>

Reply via email to