Hi,

In message "[ruby-talk:5544] Re: Some newbye question"
    on 00/10/15, Davide Marchignoli <marchign / di.unipi.it> writes:

|So, if you think that this point is worth of being discussed, please, open
|a new thread in which proposals can be posted.

OK, I changed the subject.  Feel free to change it again if you think
of a better one.

In summary, possible problems (and ugliness) are

  (1) a block parameter variable names appeared BEFORE the lambda.
      Since parameters in most languages are scope local, some (or
      even most) expect them local to the block, even if they already
      appear in the enclosing scope.

  (2) a local variable names appeared IN the block.
      When you are trying to use a variable local to the block, you
      have to assure the name of a variable is not used outside of the
      block.  You have to know all local variable names.  Although
      it's good to know all local variable names in the method, a
      programmer should be allowed to be lazy enough to avoid
      searching variable names.

  (3) a local variable names appeared AFTER the lambda.
      Since it's easy to forget about block scope rules, some (or even
      most) expect the values of block local variables preserved after
      the block.  When he meets the `undefined local variable' error,
      he should go back before the block and initialize the variable.

I admit all violates the principles of least surprise.  Hmm.

Dave's idea in [ruby-talk:5546] (i.e. lambda{<a,b> ...}) is
interesting. It'll make Ruby slightly more complex, but solves problem
1 above without incompatibility.  If no one find the problem for this,
I think I'm going to implement this in 1.7.

Guy's idea (oh, we have at least 2 Guys here ;-) this is Guy Decoux's
idea) in [ruby-talk:5545] of explicit dynamic variable declaration is
interesting too.  This is similar to my idea described in [ruby-talk:5531](2).
This may solve the problem 2.  But I feel this requires more
discussion to be a solid solution.

My idea in [ruby-talk:5531](3) is for problem 3.  This too requires
more discussion.

|I do not know which is your development model, in any case I would be glad
|to contribute both in the design and in the implementation.

I chose the 'gentle dictator' model.

|PS: did you have a look at the qsort patch?

Not yet.  Wait till I start 1.7 development.

							matz.