3 ms·
In Julia every function has a number of associated variants. We call them methods, not to be confused with methods in OOP. So for every function there is a tab
by socialdemocrat 7y ago
In Julia every function has a number of associated variants. We call them methods, not to be confused with methods in OOP.
So for every function there is a table of methods. Each method takes a different number of arguments or arguments with different types.
The REPL is able to introspect this table. So when you type a function name in Julia and hit tab, it will essentially dump this table. If you start filling in some arguments, it will use the types of those arguments to filter this table, showing you the only remaining choices.
You can even go in reverse. The function `methodswith` allows you to provide a type and Julia will search through the methods of every function to show every method accepting that type as one of its arguments.
Julia stores a lot of metadata with object and functions. You will be surprised how powerful this system is once you start using it. E.g. you can jump to the definition of a function, that was generated on the fly in a for loop. The function when created keeps track of what file and line number it was created, even if that happened through meta programming.