Skip to content

Commit 493b1e3

Browse files
committed
Added a link to native types
Since most of the other related issues have been addressed, including the early issue #1376, this closes #1879
1 parent fb29aa7 commit 493b1e3

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

doc/Language/functions.pod6

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ By default, subroutines are L<lexically scoped|/syntax/my>. That is,
6363
C<sub foo {...}> is the same as C<my sub foo {...}> and is only
6464
defined within the current scope.
6565
66-
=begin code :allow<L>
66+
=begin code
6767
sub escape($str) {
6868
# Puts a slash before non-alphanumeric characters
6969
S:g[<-alpha -digit>] = "\\$/" given $str
@@ -84,7 +84,8 @@ say escape 'foo#bar?'; # OUTPUT: «foo\#bar\?␤»
8484
say escape 'foo#bar?'; # OUTPUT: «foo\#bar\?␤»
8585
=end code
8686
87-
Subroutines don't have to be named. If unnamed, they're called I<anonymous> subroutines.
87+
Subroutines don't have to be named. If unnamed, they're called I<anonymous>
88+
subroutines.
8889
8990
say sub ($a, $b) { $a ** 2 + $b ** 2 }(3, 4) # OUTPUT: «25␤»
9091
@@ -853,7 +854,7 @@ a 1; # OUTPUT: «Int 1␤Any 2␤Back in Int with 5␤»
853854
854855
Here, C<a 1> calls the most specific C<Int> candidate first, and C<callwith>
855856
re-dispatches to the less specific C<Any> candidate. Note that although our
856-
parameter C<$x + 1> is an Int, still we call the next candidate in the chain.
857+
parameter C<$x + 1> is an C<Int>, still we call the next candidate in the chain.
857858
858859
=head2 sub nextsame
859860

doc/Language/nativecall.pod6

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The simplest imaginable use of C<NativeCall> would look something like this:
1717
The first line imports various traits and types. The next line looks like
1818
a relatively ordinary Perl 6 sub declaration—with a twist. We use the
1919
"native" trait in order to specify that the sub is actually defined in a
20-
native library. The platform-specific extension (e.g., '.so' or '.dll'),
20+
native library. The platform-specific extension (e.g., C<.so> or C<.dll>),
2121
as well as any customary prefixes (e.g., 'lib') will be added for you.
2222
2323
The first time you call "some_argless_function", the "libsomething" will be
@@ -29,6 +29,8 @@ that you can do is just adding to this simple pattern of declaring a Perl 6 sub
2929
naming it after the symbol you want to call and marking it with the "native"
3030
trait.
3131
32+
You will also need to declare and use native types. Please check L<the native types page|/language/nativetypes> for more information.
33+
3234
=head1 Changing names
3335
3436
Sometimes you want the name of your Perl subroutine to be different from the

0 commit comments

Comments
 (0)