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

deprecate whos to varinfo returning a markdown table. fixes #12131. #24671

Merged
merged 1 commit into from
Nov 22, 2017

Conversation

JeffBezanson
Copy link
Member

@JeffBezanson JeffBezanson commented Nov 20, 2017

julia> varinfo()
name                 size summary
–––––––––––––– –––––––––– –––––––
Base                      Module 
Core                      Module 
DelimitedFiles 90.200 KiB Module 
Main                      Module 

Classy, I say.

@StefanKarpinski
Copy link
Member

And you didn't want Markdown parsing and formating in the base language 😛.

@JeffBezanson
Copy link
Member Author

And I don't want varinfo in Base either...

@dpsanders
Copy link
Contributor

Maybe this could be called variables or similar? The info seems redundant.

Also, maybe it should return a dictionary instead of just printing things out? In general returning seems more useful than printing.

@dpsanders
Copy link
Contributor

dpsanders commented Nov 21, 2017

I guess instead of a dict it would be a VariableInfo type.

EDIT: That prints out nicely as the above Markdown table!

@dpsanders
Copy link
Contributor

(Sorry, didn't look carefully enough: It does return the Markdown table. But maybe an indexable object is more useful.)

@JeffBezanson
Copy link
Member Author

I think for any serious use one should use names and other reflection functions, which make it pretty easy to get all the info you want.

@JeffBezanson JeffBezanson merged commit 1826335 into master Nov 22, 2017
@JeffBezanson JeffBezanson deleted the jb/varinfo_table branch November 22, 2017 17:49
@nalimilan
Copy link
Member

I must say I feel uneasy about this design too. Returning a Markdown object really sounds like conflating contents and display. AFAIK that's the only place where we do that. Why not return a simple struct, with a custom method to print it as a Markdown table? This is what we do e.g. for StatsBase.summarystats.

(It would also make sense to have a generic type to hold lightweight tables like this, but time is a bit short to add this to 0.7.)

@StefanKarpinski
Copy link
Member

StefanKarpinski commented Nov 23, 2017

I agree that returning a markdown object here is a bit weird. An option is that we can just document that as an interactive function whose return value is not particularly useful as data, this may change in the future. Then we can add a lightweight table type whenever we want to and return it here.

On the whole, we're not going to freeze the behavior of interactive functionality because we really want to improve the interactive experience and as long as things that used to do something useful still do a similarly useful thing, people won't be too bothered. They don't really care about identical output for varinfo for example, but they would be quite rightly annoyed if we changed the name to something completely different and examples in books and on the internet stopped working.

@JeffBezanson
Copy link
Member Author

Yes, please remember what this function is really for. It's not for programmatically getting information about variables; it's terrible for that and always has been since before this it didn't even return anything. The only point of it is to provide this display, and returning a markdown table is a way to do that that works in multiple environments like ijulia. Since the purpose of this is display, it makes sense to return a display-oriented object.

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.

4 participants