DRAFT: Synopsis 32: Setting Library - Callable
Tim Nelson <wayland@wayland.id.au> Larry Wall <larry@wall.org>
Created: 26 Feb 2009 Last Modified: 3 May 2009 Version: 2
The document is a draft.
If you read the HTML version, it is generated from the Pod in the specs repository under https://github.com/perl6/specs/blob/master/S32-setting-library/Callable.pod so edit it there in the git repository if you would like to make changes.
This document documents Code, Block, Signature, Capture, Routine, Sub, Method, Submethod, and Macro.
role Callable {...}
The Callable role implies the ability to support postcircumfix:<( )>.
Callable
postcircumfix:<( )>
# Base class for all executable objects role Code { method Signature signature() {...} method Code assuming(...) {...} method do() {...} # See L<S12/Introspection> method Bool defined {...} # XXX What does do() return? I mean, it's a "method body", but what's that? }
For Code, the .defined method returns whether a body has been defined. A body consisting only of ..., !!!, or ??? (with optional message arguments) does not count as defined.
Code
.defined
...
!!!
???
To test if a name has been declared, look up the symbol in the appropriate symbol table.
# Executable objects that have lexical scopes role Block does Code does Callable { method next() {...} method last() {...} method redo() {...} method leave() {...} method labels() {...} method as() {...} # See L<S12/Introspection> and L<S02/Value types> }
# Function parameters (left-hand side of a binding) role Signature {...}
# Function call arguments (right-hand side of a binding) role Capture does Positional does Associative {...}
role WrapHandle {...}
class Routine does Block { method WrapHandle wrap(Code $code) {...} method Routine unwrap(Wraphandle $original) {...} method Str name() {...} method Bool multi() {...} }
See "Wrapping" in S06.
method wrap(Code $code) {...}
class Sub isa Routine {...}
class Method isa Routine {...}
class Submethod isa Routine {...} # XXX or should this be isa Sub
class Macro isa Routine {...}
Please post errors and feedback to perl6-language. If you are making a general laundry list, please separate messages by topic.
To install Perl6::Doc, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perl6::Doc
CPAN shell
perl -MCPAN -e shell install Perl6::Doc
For more information on module installation, please visit the detailed CPAN module installation guide.