Reflection/Get source: Difference between revisions

Content added Content deleted
m (→‎{{header|Perl 6}}: full path is provided for built-ins)
Line 121: Line 121:


=={{header|Perl 6}}==
=={{header|Perl 6}}==
{{Works with|rakudo|2016.11}}


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


A full path is provided for built-in routines/methods. However for routines exported by pre-compiled modules a precompilation hash is returned, not a proper file path.
Filename of a method:
<lang perl6>say Date.^find_method("day-of-week").file;</lang>


<lang perl6>say &sum.file;
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.
say Date.^find_method("day-of-week").file;</lang>

{{out}}
<pre>
SETTING::src/core/Any.pm
SETTING::src/core/Dateish.pm
</pre>


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