Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
start to document ClassHOW
  • Loading branch information
moritz committed Jan 12, 2015
1 parent ec60a18 commit cd28fdf
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions lib/Type/Metamodel/ClassHOW.pod
@@ -0,0 +1,61 @@
=begin pod
=TITLE class Metamodel::ClassHOW
=SUBTITLE Meta class for for classes. HOW circular.
class Metamodel::ClassHOW
does Perl6::Metamodel::Naming
does Perl6::Metamodel::Documenting
does Perl6::Metamodel::Versioning
does Perl6::Metamodel::Stashing
does Perl6::Metamodel::AttributeContainer
does Perl6::Metamodel::MethodContainer
does Perl6::Metamodel::PrivateMethodContainer
does Perl6::Metamodel::MultiMethodContainer
does Perl6::Metamodel::RoleContainer
does Perl6::Metamodel::MultipleInheritance
does Perl6::Metamodel::DefaultParent
does Perl6::Metamodel::C3MRO
does Perl6::Metamodel::MROBasedMethodDispatch
does Perl6::Metamodel::MROBasedTypeChecking
does Perl6::Metamodel::Trusting
does Perl6::Metamodel::BUILDPLAN
does Perl6::Metamodel::Mixins
does Perl6::Metamodel::ArrayType
does Perl6::Metamodel::BoolificationProtocol
does Perl6::Metamodel::REPRComposeProtocol
does Perl6::Metamodel::InvocationProtocol
does Perl6::Metamodel::Finalization
{ }
C<Metamodel::ClassHOW> is the meta class behind the C<class> keyword.
say so Int.HOW ~~ Metamodel::ClassHOW; # True
say say Int.^methods(:all).pick.name; # sin
=head1 Methods
=head2 method add_fallback
method add_fallback(Metamodel::ClassHOW:D: $condition, $calculator)
Installs a method fallback, that is, add a way to call methods that weren't
statically added.
Both C<$condition> and C<$calculator> must be callables that receive the
invocant and the method name once a method is called that can't be found in
the method cache.
If C<$condition> returns a true value,
C<$calculator> is called with the same arguments, and must return the code
object to be invoked as the method, and is added to the method cache..
If C<$conditon> returns a false value, the
next fallback (if any) is tried, and if none matches, an exception
L<of type X::Method::NotFound|/type/X::Method::NotFound> is thrown.
User-facing code (that is, ,code not dabbling with meta classes) should use
method C<FALLBACK> instead.
=end pod

0 comments on commit cd28fdf

Please sign in to comment.