Hacker News new | ask | show | jobs
by maximsch2 4187 days ago
This is probably mostly a UI/IDE question (although lack of object method call notation doesn't help), but what's stopping me now from using Julia is discoverability of functions. I'm just too used to typing obj.<tab> and going through a list of functions in something like IPython. In Julia, it seems like you have to dig through docs to find functions that you need.
2 comments

Check out `methodswith(typeof(obj))` and `methodswith(typeof(obj), true)` (which shows the parent type methods, too).
Thanks for the pointer! There is a big difference between having an easy tab completion vs running `methodswith` every time you want to call a method. But the fact that it's possible to do right now makes me hopeful, that it should be a built-in function of REPL and IJulia some time in the future.
While I appreciate the convenience of this, I think you may be misunderstanding how Julia does method dispatch. Rather than dispatching purely on the type of their first argument (as in Python) or into a class hierarchy/namespace based on that argument, then by parameter types (ala Java) Julia methods are fully qualified over every parameter type.

Sadly, that makes it hard to ask the question "what methods can I call on an object of this type?" because the answer might include functions with that type in any parameter position. In many cases that wouldn't be a meaningful answer - as in the case of, say, a numeric type which could be used for all kinds of indexing, iteration, and offset methods involving collections, IO handles, etc.

You might benefit a bit more from using the 'apropos' builtin to lookup functions based on simple keyword matching. Given a type name it lists methods that take or emit objects of that type (which may or may not be exactly what you want, but it's a starting point at least).