Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FAQ] return constraint
  • Loading branch information
stmuk committed Oct 21, 2015
1 parent 1eb2878 commit 24ce248
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -31,7 +31,8 @@ computer by starting the included `app.pl` program:
You can then view the examples documentation by pointing your web browser at
http://localhost:3000.

You will need at least Mojolicious installed.
You will need at least Mojolicious installed and Inline::Python is recommended
to speed up the syntax highlighting phase.

--------

Expand Down
15 changes: 14 additions & 1 deletion doc/Language/faq.pod
Expand Up @@ -67,6 +67,19 @@ Likewise C<:U> constrains to undefined values, that is, type objects.
To explicitly allow either type objects or instances, you can use C<:_>.
=head2 What is the --> thing in the signature?
--> is a return constraint checked at compile time.
Example:
sub foo ( Int $a, Int $b --> Int ) {
return $a + $b;
}
foo(2,3.1)
# Calling foo(Int, Rat) will never work with declared signature (Int $a, Int $b --> Int)
=head2 How can I extract the values from a Junction?
If you want to extract the values (eigenstates) from a
Expand Down Expand Up @@ -254,7 +267,7 @@ the exception with the C<exception> method.
=head2 Why is C<wantarray> or C<want> gone? Can I return different things in different contexts?
Perl has the C<wantarray> function that tells you whether it is called in
Perl 5 has the C<wantarray> function that tells you whether it is called in
void, scalar or list context. Perl 6 has no equivalent construct,
because context does not flow inwards, i.e. a routine cannot know which
context it is called in.
Expand Down

0 comments on commit 24ce248

Please sign in to comment.