>===== Original Message From Dave Thomas <Dave / PragmaticProgrammer.com> =====
>"W. Kent Starr" <elderburn / mindspring.com> writes:
>
>> Yes and no. The "problem" is not behavior within my own code or your
>> own code. _We_ can control that. The problem is me using your code
>> and vice versa where we may use predefined loops with variables that
>> step over each others next scope up variables. The point is, when
>> _you_ use portions of my code, either as snippets (where you can see
>> the problem) or as predefiend Procs (where you can still see, but
>> with more study). Bottomline is that _you_ should be able to use my
>> predined "cool" proc with no effort and still feel safe realative
>> any of your variables in the next space up.
>
>But to do that, you'd have to cut and paste the code into your
>code. And whenever you do that, you're risking clashes of one sort or
>another. We could have methods of the same name, or globals, or
>classes, or whatever. I'm not sure I see why this particular issue is
>worse.
With the various variations on eval (instance eval, etc) it is
not hard to get into this. Similarly autogenerated code.
>Could you give an example of a problem that has occurred this way?
My reason for wanting an explicit notation is actually quite
different. As mentioned before (someone may have responded,
I am diving through a backlog of emails) I would like to see
the ability to catch my typos. Something equivalent to Perl's
strict. It saves me a lot of time and headaches there, and I
would like the same facility. Therefore the ability to nest
scopes is not actually as important as the ability to be
explicit. In fact if Ruby did not allowed me to nest scopes,
but *did* allow me to optionally disallow local variables that
have not been initialized explicitly, that would satisfy my
desire.
The proposal for := vs = would be perfect. As I say, for a
first pass having := not be allowed to nest would be fine, so
long as there was the corresponding optional pragma to have
the := be required in a given scope. (Which I would always
do, but that is another story.)
Cheers,
Ben
-------------------------------------------
The Fastest Browser on Earth now for FREE!!
Download Opera 5 for Windows now! Get it at
http://www.opera.com/download/
-------------------------------------------