News for hackers. Stuff that matters.
Re:How would you change your favorite programming language t... by ericb on Sunday December 11, 2011 @05:54PM (#3341403)
I would add coffeescript-style instance variable setting to ruby method definitions like so:

  def initialize(foo, bar, baz)

    @foo=foo

    @bar=bar

    @baz=baz

  end

Would now be:

  def initialize(@foo, @bar, @baz)

  end

This would save hundreds of lines of code in large programs-- lines which could no longer be a source of typos or errors.

Oh, also I'd make binding_of_caller work.

Re:How would you change your favorite programming language t... by Miky on Sunday December 11, 2011 @06:58PM (#3341561)
I was under the impression that you could already do that in Ruby, although I don't use it much and very well could be wrong.

Edit: Never mind, I just tried it and got an error.

Weird. I could have sworn I'd seen it done somewhere.

Re:How would you change your favorite programming language t... by raganwald on Sunday December 11, 2011 @07:11PM (#3341595)
That falls out of destructuring, so if you order def foo(@bar) now, we'll throw in a free

  {@kbar, fu: @bar, blitz: [@first, @rest...]} = someHash
At no extra charge.
Re:How would you change your favorite programming language t... by ericb on Monday December 12, 2011 @07:07AM (#3343291)
Perhaps it is the wording, but I actually have no understanding of what you just said. I'm interested though, so can you expand on that a bit?
Re:How would you change your favorite programming language t... by raganwald on Monday December 12, 2011 @11:13AM (#3343911)
CoffeeScript implements def foo (@bar, @blitz) using destructuring assignment, a general facility that applies to assignment statements, not just function calls.
Re:How would you change your favorite programming language t... by orangecat on Sunday December 11, 2011 @07:08PM (#3341591)
That would be my answer for Python as well. Interesting that both languages have the same flaw, when they're normally very good about eliminating boilerplate.