-
Notifications
You must be signed in to change notification settings - Fork 21.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Method#source_code #18473
Comments
I'll check this!! |
Doesn't pry already provide this? |
Link?
|
Not quite the same thing. Doesn’t seem to work off dynamic methods, like the one I used in the example.
|
Works just fine for me?
|
Ah, it wasn’t listed as one of the examples. In any case, taking on all of pry because you want this seems like shooting pigeons with canons. Pry is an omnibus of stuff.
|
It's by far the most popular debugger. Why include hefty debug methods in every rails app, when a very ubiquitous gem which focuses solely on debugging does the same thing? This feels like Not Invented Here Syndrome to me. |
It’s great that there’s a omnibus gem that adds a ton of shit for people who want that. Rails is full of small slices of functionality that’s also included in gems with the kitchen sink included. I see no conflict with that.
|
Just seems like we're needlessly duplicating work, and adding more code that we have to maintain. Maybe it's worth reaching out to the pry guys to see if a common module could be pulled out that just provides this functionality, rather than replicating it wholesale? |
Please do! Not interested in taking on a dependency gem, though. But if they want to extract Method#source_code, put it into AS, and then use it from Pry, that’s cool with me 👍.
|
Can we not do this? You know it doesn't make sense for a gem which has nothing to do with Rails to move their functionality into Rails, and add AS as a dependency. I'm just saying we might want to think about the maintenance cost of adding something like this to Rails, especially when it's already provided elsewhere. I once read a really good book by some project management software guys about how every feature you add has a hidden cost. |
Well, how about we see what kind of work this actually turns out to be. Guillermo has already assigned the ticket to himself, so he’s interested in working on it. Let’s give him a chance to see what kind of implementation this will take. Every feature does have a cost. That’s exactly why I have no interest in depending on Pry in Rails given their laundry list of stuff. If you want one thing out of 100 on offer, I consider it completely reasonable to reimplement that one thing, rather than depend on a package that adds the whole 100.
|
For the record, I'm not advocating for depending on pry in Rails. I'm advocating for having this functionality be provided by other gems, which people can choose to use if they need it. |
So if you want to have this functionality, you have to depend on all of pry? Yeah, that's not an answer that appeals to me. |
|
If you're interested in handling that, have at it! Otherwise I'm happy to see what @guilleiguaran comes up with before considering an external dependency. |
The |
Appears to do what we need.
|
That could be a good temporary solution until we can just get method end
|
I almost wonder if there could be a light variant of pry, stripped down much in the style of Rspec Core. There's already Pry Plus, so it wouldn't be unfathomable to further break it up. At the same time, it'd depend how @banister and @cirwin view the idea. It may be a tinge bold to say, but Pry seems to be borderline ubiquitous. Finding a way to tie it in would be of great benefit, this granting the presence of a lighter variant. Admittedly I find it a tinge ironic that Rails views Pry as an omnibus, but that's a different matter entirely. |
@baweaver i think there is potential for a gem that just contains the Pry introspection APIs. Some of our APIs go well beyond the basic functionality in |
I guess it depends on the circles in which you travel to see Pry as ubiquitous. I've heard the same claims about rspec: All my friends use it, so it must be The Standard. Rails is certainly an omnibus itself, which makes it all the more imperative that we restrict our appetite for additions to be more like additional appetizers and not 21-course meals. But always happy to consider proposals for integration. At the end of the day, we all want the same thing: Better debugging for Rails applications! If there's a good way to work with Pry to enhance that within the scope of our waist line, that would be great. Pry has certainly put in a lot of work and thought into the debugging process and we'd be wise to learn from that 👍
|
In the mean time, the feature at hand is already in a separate gem. It looks like the method_source gem which pry depends on gives exactly this feature, and nothing else. Seems to fit the bill, as well as addresses all of the concerns raised in this thread (not including an omnibus) |
Yup. I say we start by including that, then work with Ruby core through On Tuesday, January 13, 2015, Sean Griffin notifications@github.com wrote:
|
Rather than having it as an actual dependency of Rails, why don't we add it On Tue, Jan 13, 2015, 8:30 AM David Heinemeier Hansson <
|
That sounds like a good start as well. 👍
|
Common pattern for me is to inspect the source code of a method I'm curious about like so:
Then copy the path to the clipboard, then go to the console and do
mate path
, then APPLE-G to jump to the line.Let's make that simpler:
The text was updated successfully, but these errors were encountered: