Skip to content

Instantly share code, notes, and snippets.

@lukaszkorecki
Last active December 11, 2015 11:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukaszkorecki/4596308 to your computer and use it in GitHub Desktop.
Save lukaszkorecki/4596308 to your computer and use it in GitHub Desktop.
Would be cool if this was possible. I know(ish) why it's hard to do.... But it would be cool :-)
def ok a ; puts "ok #{a} " ; end
ok 1 # => "ok 1"
def yo a ; puts "yo #{a}" ; end
yo 1 # => "yo 1"
ok(a), yo(b) = [1,2] # => exception!
a , b = [1,2]; ok(a) ; yo(b) # => meh!
@pdc
Copy link

pdc commented Jan 22, 2013

Interesting but how often would you use it?

@lukaszkorecki
Copy link
Author

hm, for example in Sinatra:

get '/lolz' do

  # something
  body(b), status(x) = return_body_and_status(some_data)

end

or some cool processing stuff like

[ a.reverse, b.downcase = ["ab", "AA"] ].reduce("") { |c,i| c + i } # => "baaa"

@tomekwojcik
Copy link

As long as it would be quite a nice feature, I think it would also mess with the code readability. At least from my pythonic point of view :). BTW, it doesn't work in Python, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment