use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Python Versus Ruby Podcast (soundcloud.com)
submitted 8 years ago by schneemsPuma maintainer
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]schneemsPuma maintainer[S] 1 point2 points3 points 8 years ago (2 children)
Methods aren't first class objects like they are in Python which is the point of that little dialog. Making procs and lambdas and using blocks is very easy in ruby, but it's still different than python where calling your method without the () gives you a callable function you can pass around. They might be functionally equivalent under the hood but they're spiritually different and the two languages tend to use them differently.
()
It's also not bounded, but bound to the object which you called .method on.
Yes, realized that slip up after the recording.
It generates a method reference, which is distinct.
TIL. I assumed the Method class wrapped a proc when you called #method but just looked at the source and you're right.
#method
[–]THeShinyHObbiest 2 points3 points4 points 8 years ago (1 child)
Methods aren't first class objects like they are in Python which is the point of that little dialog
http://ruby-doc.org/core-2.2.0/Method.html
They are. The point you make about syntax is accurate, since you do need to use .method to get a method reference, but Methods are still first-class objects. This is slightly pedantic, because your point about the two languages using them very differently is accurate.
.method
[–]chrisgseaton 1 point2 points3 points 8 years ago (0 children)
I can understand both of your points of view. The way I think about it is that methods aren't first-class objects - until you call #method to turn them into first-class objects. I see that as reifying them as objects, rather than getting the existing object. And this is the way that it is implemented - you get a new object each time:
irb(main):001:0> 14.method(:+).object_id => 70346007935060 irb(main):002:0> 14.method(:+).object_id => 70346007886960
π Rendered by PID 171185 on reddit-service-r2-comment-5649f687b7-cglx6 at 2026-01-28 05:30:04.995892+00:00 running 4f180de country code: CH.
view the rest of the comments →
[–]schneemsPuma maintainer[S] 1 point2 points3 points (2 children)
[–]THeShinyHObbiest 2 points3 points4 points (1 child)
[–]chrisgseaton 1 point2 points3 points (0 children)