Reflection/Get source: Difference between revisions

Content added Content deleted
(J draft)
(add Perl 6)
Line 56: Line 56:
// "function sqrt() { [native code] }"
// "function sqrt() { [native code] }"
</lang>
</lang>

=={{header|Perl 6}}==

Filename of a subroutine:
<lang perl6>say &sum.file;</lang>

Filename of a method:
<lang perl6>say Date.^find_method("day-of-week").file;</lang>

Unfortunately, as of Rakudo 6.c on MoarVM, it prints a precompilation hash (rather than a proper file path) for routines exported by pre-compiled modules, and just <code>gen/moar/m-CORE.setting</code> (rather than a full path) for built-ins.


=={{header|Python}}==
=={{header|Python}}==