From: matz@... (Yukihiro Matsumoto) Date: 2000-04-23T01:41:20+09:00 Subject: [ruby-talk:02568] Re: Default naming for iterator parameters Hi, In message "[ruby-talk:02558] Re: Default naming for iterator parameters" on 00/04/21, mrilu writes: |>reading other people's code: "where'd *that* variable come from? hmm, not up |>here, not over here, oh it maybe it's one of those magic parameters, where's |>the documentation for this iterator? well, it's coming from the object `foo', |>so what class is `foo'? *page page* aha, looks like it's a Bar, or maybe a |>subclass. well, there is no doc for Bar#iterator, but aha, the Baz mix-in |>does have iterator! ok, now where was I?" | |This could be very true. We might lose some readibility. I don't have so much |experience of the world of Ruby iterators to be able to judge whether |one can associate iterators variables at once or it will cause confusion. In addition, the parser requires all local variable names to be known at compile time. It treats unknown local variables as method invocation without argument. This behavior also frees programmer from searching around variable declarations. There's no way to get magic variables names at compile time in general, because the method invocation may appear before its definition, which is done at runtime. I have no idea to resolve this. Assuming it's not impossible, it may require to add awkward rules to the syntax. I think introducing magic variables makes your programs bit more concise, but far more complicated. matz.