From: "Brian Schröder" Date: 2005-07-28T19:15:48+09:00 Subject: Re: Idea for Ruby 2.0 On 28/07/05, Nikolai Weibull wrote: > Lately I've found myself using pseudo-anonymous variables a lot, e.g., > something like this: > > [[1, 2], [2, 3], [3, 4]].each{ |first, _| fs << first } > > The idea is that I'm not interested in the second part of the internal > arrays, only the first. The lowline works, but obviously for one > parameter, as it is a valid identifier. I was thinking whether Ruby 2.0 > should introduce I-don't-care-type variables, like Haskell or Prolog > has. It would make all identifiers beginning with a lowline invalid, > except in parameter-lists, which could mean too much incompatability > with Ruby 1.x, but perhaps it's worth at least some thought?, > nikolai > > -- > Nikolai Weibull: now available free of charge at http://bitwi.se/! > Born in Chicago, IL USA; currently residing in Gothenburg, Sweden. > main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} > > Why would it make all identifiers beginning with an underscore invalid? One don't care variable should be enough for everybody I think ;-). a, _, b, _, c = *function() would make sense to me, though a, _a, b, _b, c = *function() could continue to set five variables. Otherwise I like this at least on first sight. I indeed needed it for some small scripts just a short while ago. There I used something like my second example and simply ignored _a and _b, but the first example would have been less intrusive to me. regards, Brian -- http://ruby.brian-schroeder.de/ Stringed instrument chords: http://chordlist.brian-schroeder.de/