From: Mike Wilson Date: 2001-03-06T02:30:25+09:00 Subject: [ruby-talk:12045] RCR Summary 03/05/01 RCR's which need to be or are being discussed #U001 cut operator for short-circuiting method chains The idea of this is that methods such as sort!() would be ideal to use in a chain, except for its sometimes returning nil. I proposed that an operator (which I called cut, vaguely after the Prolog cut) would break the chain in the case where it was used with a nil receiver. Otherwise it would just pass on the receiver. At present I cannot access the archives for some unknown reason, but I hope to come back and amend this entry when I can find pointers to the discussions on this. previously discussed - [ruby-talk:3893] [ruby-talk:3932] [ruby-talk:6131] [ruby-talk:6178] posted to ruby-talk 02/13/01 [ruby-talk:10804] by Mike Wilson (for Hugh) #U002 new proper name for Hash#indexes, Array#indexes I have to admint `indexes' is not good name, since its behavior (returning values corresponded to keys/indexes) not consistent with one of `index' (returning key/index of value). Let's face it. I decided to declare them obsolete and give proper new names in the future (1.7 and forth coming 1.8/2.0). Do you have any idea of good name for them? I'm not going to remove them, just give warning if you use them. matz. previously discussed - [ruby-talk:8916] [ruby-talk:8920] [ruby-talk:8921] [ruby-talk:8973] posted to ruby-talk 02/14/01 [ruby-talk:10830] by matz #U003 infix 'function composition' operator I'd sure like an infix 'function composition' operator for "chaining" proc's but I'm not sure this is important or generally useful to include in the language as opposed to requiring a file with the code: class Proc def *(other) raise unless arity == other.arity proc {|*a| self.call(other.call(*a))} end end (and then, as a side-note being able to do: f = lambda{|x| 2*x} g = lambda{|x| x+1} h = f * g h.call 1 # => 4 # and why not throw in some syntactic sugar for the "lambda{|x| ...}" # stuff � la Haskells "\x -> 2*x" while we're at it! ) previously discussed - no archives found posted to ruby-talk 02/14/01 [ruby-talk:10837] by Robert Feldt #U004 More list operators I'd like more list operators in Ruby, like those found in languages such as Haskell, Lisp, Prolog, Icon, Erlang,.... Ideally I'd like them as methods of Array, implemented in C for optimal performance. previously discussed - [ruby-talk:9479] posted to RubyWishList(the wish list is obsolete) by Hugh Sasse #U005 Discuss possibility of icon-like suspend or "inside-out yield" Icon has the suspend command (see http://www.cs.arizona.edu/icon/refernce/infix3.htm#suspend for example) which allows a function to produce a result in the way that return does, but it suspends execution so that if the function is called again in the same context execution can continue from where the suspend left off. It could be considered to be an inside-out yield. This is used to create generators rather than iterators. It is achieved by leaving the state of the function on the stack. I suspect this may give a more functional style of programming than Ruby's iterators, but messing around with the stack in this way may be considered messy. It might be possible for the function to carry its state with it in some other way like closures do. previously discussed - [ruby-talk:6641] ? posted to RubyWishList(the wish list is obsolete) by Hugh Sasse #U006 Alternate variable declaration Another way to declare that something is a variable. Like "let" in Lisp or "my" in Perl. By itself this is useful as a way of telling Ruby that I don't care if there is already something in scope called foo, this foo is private. previously discussed - no archives found posted to ruby-talk 02/16/01 [ruby-talk:10975] [ruby-talk:10990] by Ben Tilly #U007 Pragma to disallow variable creation with just an assignment request that there be a pragma to (lexically) disallow declaring a variable by just assigning to it. Combining #U007 with #U006 could protect users from typos ala perl's use strict "vars" previously discussed - no archives found posted to ruby-talk 02/16/01 [ruby-talk:10975] [ruby-talk:10990] by Ben Tilly #U008 Keep track of implicitly called methods request to keep track of what methods have been implicitly called and have a function you can call that checks that they all resolve properly. If you make a habit of adding this at the end of classes, this will catch the common error where a method will blow up later due to a typo. (There is, of course, no good way to test for typos in explicit method calls. That wouldn't stop it from being a useful feature though.) ala perl's use strict "subs" previously discussed - no archives found posted to ruby-talk 02/16/01 [ruby-talk:10975] [ruby-talk:10990] by Ben Tilly #U009 Allow "#{foo} bar" to be used as "#foo bar" Would like to be able to use #foo in place of #{foo} (Just to stop people complaining that interpolation requires 2 extra characters.) ala perl's "$foo bar" previously discussed - no archives found posted to ruby-talk 02/16/01 [ruby-talk:10990] by Ben Tilly #U010 new method Enumerable#hashify(value) Return a hash based on iterating through the receiver (an enumerable), either setting every value to the parameter "value" or setting the values via a block. previously discussed - [ruby-talk:6593] [ruby-talk:6611] [ruby-talk:6663] [ruby-talk:7186] [ruby-talk:7367] [ruby-talk:7368] [ruby-talk:7371] [ruby-talk:7427] posted to ruby-talk 02/20/01 [ruby-talk:11195] by David Alan Black #U011 Add a method: Time#set(seconds <,microseconds) This method, which is much like Time.at, will alter an existing Time object. I think making Time mutable is a big change. We must discuss carefully before making decision. previously discussed - [ruby-talk:11426] [ruby-talk:11381] posted to ruby-talk 02/25/01 [ruby-talk:11531] by matz #U012 Discuss making Ruby XML-ready "out of the box" IMHO, all future Ruby distributions (tgz, InstallShield?) ought to be "XML-ready" out of the box. I think XML is going to be the "sort-of next big thing"--i.e. not *that* big, but big *enough* to matter. (Where's my marketing hat. Ahh, here it is. "Why dork around with Perl, Python, or Tcl when Ruby supports XML out of the box?") previously discussed - no archives found posted to ruby-talk 02/26/01 [ruby-talk:11619] by Conrad Schneiker #U013 shortcut for instance variable initialization I'm constantly creating small classes, and many of them start something like: class Msg def initialize(name, type, txt) @name, @type, @txt = name, type, txt end # ... end So, could we change parameter passing slightly so that if an instance method has a formal parameter starting with an '@' sign, the incoming value is assigned directly to the corresponding instance variable? Using this scheme I could write the above as: class Msg def initialize(@name, @type, @txt) end end previously discussed - no archives found posted to ruby-talk 02/26/01 [ruby-talk:11633] by Dave Thomas #U014 new method, instance_eval + value passing matz has proposed that there should be a method with functionality similar to instance_eval but with the ability to pass values to the evaluating block. matz suggests that the behavior contradicts the name and role of instance_eval, and so a new method with a new name should be implemented. instance_yield is noted as being one possible name. previously discussed - no archives found posted to ruby-talk 03/01/01 [ruby-talk:11881] by matz _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com