Skip to content
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

which(io, f, args) #5467

Closed
wants to merge 1 commit into from
Closed

Conversation

WestleyArgentum
Copy link
Member

I'm in a situation where I can't get output from which. It seems like it should accept an IO parameter instead of just printing to STDOUT.

To be honest, I'd also really like to see it return a reference to the function that would be called.

I'm in a situation where I can't get output from `which`. It seems like it should accept an `IO` parameter instead of just printing to `STDOUT`.

To be honest, I'd also really like to see it return a reference to the function that would be called.
@StefanKarpinski
Copy link
Sponsor Member

See also #5464.

@JeffBezanson
Copy link
Sponsor Member

Yes, there is no reason for these to just print stuff. The underlying function methods returns an array of Method objects, whose display is basically equally useful. So all of these things might as well return useful values.

@WestleyArgentum
Copy link
Member Author

Wow, timely. It sounds like #5464 is the way to go then!

@stevengj
Copy link
Member

Note that #5464 did not change the return type of which; it still prints the method (albeit by using display).

It would be pretty easy to change whicht to return d instead of display(d) (util.jl:97), however. This would still display the result, and would do what you want.

(Not sure what it should return if nothing is found. nothing? That is not type-stable, but maybe that's not important for which.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants