From: Robert Klemme Date: 2009-04-11T17:45:05+09:00 Subject: Re: a few thoughts for ruby... On 11.04.2009 06:52, Roger Pack wrote: > Thought I'd pass these thoughts by the readers here before sending them > to core. They're my current wish list :) > > 1) add an Object#in? method to complement the existing Array#include? -0 I don't see the benefit but I'm also not strongly against. I do see Joel's point about the reversion. Basically it is strange that every object should be able to answer a question that only the collection can answer. Plus, you can easily add it yourself if you need it. > 2) add some useful lists of exceptions, ex: IO.SELECT_EXCEPTIONS, > IO.READ_EXCEPTIONS, so that you can rescue the wide gamut of them > appropriately, should you desire to. A good idea. But I do not know how feasible this is. Not all OS have the same error reporting mechanisms and the mapping from OS errors to exception types would have to be maintained of all platforms. > 3) provide an easier way to know which platform you're on than > RUBY_PLATFORM =~ /mswin32|dgjpp|mingw/ -1 This would make a Ruby specific unification of operating systems necessary. This means that not only maintainers of automake need to keep track of operating systems but also maintainers of Ruby. Other difficulties are: how much level of detail do you provide? For one application it may be enough to know it's running on Linux, the other one needs to know the kernel version and a third one does not bother about versions but must know the distro. I see too much effort for too little benefit. > 4) (this one's controversial) remove the extra # for code in strings > (i.e. "string#{code}") -> "string{code}" less typing. -1 Definitively a don't as the overhead of typing # isn't too big (plus, it is more easily spotted) and the potential for damage caused by this is large. > 5) add a BigDecimal(float) method. > -> BigDecimal.new("%f" % float) 0 Seems reasonable at first sight but the absence might have a reason. For example, by making the conversion to String explicit it is more obvious that float and BigDecimal are not really compatible. > 6) add Dir.directory? > -> File.directory? 0 Btw, there is also this nice idiom for those tests if test ?d, "some dir" Kind regards robert