functionloc(f, types)

functionloc(f::Function, types)

Returns a tuple (filename,line) giving the location of a generic Function definition.

Examples

julia> function foo(x)
           return x^2
       end
foo (generic function with 1 method)

julia> method_foo = methodswith(typeof(foo))[1]
# first method definition of foo

julia> loc(method_foo)
("REPL[1]", 2)

In the above example, we define a function foo and obtain its method method_foo. By using the loc function with the method_foo, we get the location of the method's definition as a tuple (filename, line). In this case, the method is defined in the REPL, and the definition can be found at line 2 in the REPL.

Note: The filename and line number may vary depending on the environment in which the code is executed.

See Also

abspath, basename, chmod, countlines, cp, ctime, dirname, download, evalfile, expanduser, fdio, filemode, filesize, functionloc, gperm, homedir, include_string, isabspath, isblockdev, ischardev, isdir, isdirpath, isexecutable, isfifo, isfile, islink, ismount, ispath, isreadable, issetgid, issetuid, issticky, iswritable, joinpath, less, lstat, mkdir, mkpath, mktemp, mktempdir, mtime, mv, normpath, operm, poll_fd, poll_file, readall, readcsv, readdir, readdlm, readlines, readlink, realpath, relpath, rm, splitdir, splitdrive, splitext, stat, symlink, tempdir, tempname, touch, truncate, uperm, watch_file, writecsv,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: