On Fri, May 2, 2008 at 9:37 AM, coderrr <coderrr.contact / gmail.com> wrote: > Hey I just put together a list of stuff I totally wish Ruby had and I > think would make a lot of people's lives better. > > In the order of importance: > > 1) rescue/ensure available in all blocks I agree. > > 2) two line if/while statements (like c): > if true > p :true > p :im_outside_of_if Can't agree with this; I don't really like it, and if you really need a two-line conditional, you can split the single-line form with a line continuation, like p :true \ if true p :outside_of_conditional > > 3) rescue a specific exception type inline I like that. > 4) inline do/while statements: > d = s.read dowhile d > > I dislike that the inline while functions exactly like a normal while > loop, checking the while condition before the initial run. I would > prefer if it acted like a begin ... end while loop, checking the > while condition after the first iteration. I don't really care to > change how the while keyword works, but it'd be nice if a new keyword > acted this way, maybe dowhile? I haven't thought up a good name yet. I see where you're coming from, but think the best way to deal with this, as you suggest below, is to provide a compact begin ... end syntax, especially for single-line use. > > 5) more concise (inline) syntax for begin...end > begin ret = a.delete something end while ret <--- gross > begin { ret = a.delete something } while ret > or: do { ... } while > > An alternative to #4 is just to make writing begin/end blocks much > nicer. Perhaps an inline version like: do { } Then it would be > simple to get the while functionality I desire. I like this, but fear that the potential to appear to be a method call (or to conflict with method calls in existing code, if someone has defined "do" methods on certain objects) might be a problem; it would probably be better to have something that didn't have that problem. Maybe something like %{ ... }?