Author: wayland Date: 2009-03-05 06:58:38 +0100 (Thu, 05 Mar 2009) New Revision: 25698
Modified: docs/Perl6/Spec/S32-setting-library/Any.pod docs/Perl6/Spec/S32-setting-library/Scalar.pod Log: - Moved "defined" and "undefined" from Scalar.pod to Any.pod, as per signature - Defined the Pattern role for Any Modified: docs/Perl6/Spec/S32-setting-library/Any.pod =================================================================== --- docs/Perl6/Spec/S32-setting-library/Any.pod 2009-03-05 03:54:17 UTC (rev 25697) +++ docs/Perl6/Spec/S32-setting-library/Any.pod 2009-03-05 05:58:38 UTC (rev 25698) @@ -28,8 +28,65 @@ The following are defined in the C<Any> role: + role Any does Object does Pattern { + our Bool multi sub eqv (Ordering @by, $a, $b) {...} + our Bool multi sub eqv (Ordering $by = &infix:<eqv>, $a, $b) {...} + + our Bool multi method defined ( Any $self) {...} + our Bool multi method defined ( Any $self, ::role ) {...} + + our multi method undefine( Any $self ) {...} + + our multi method clone (::T $self --> T) {...} + our multi method clone (::T $self, *%attributes --> T) {...} + + our Order multi sub cmp (Ordering @by, $a, $b) {...} + our Order multi sub cmp (Ordering $by = &infix:<cmp>, $a, $b) {...} + + our Callable multi method can ($self:, Str $method) {...} + our Bool multi method does ($self:, $type) {...} + our Bool multi method isa ($self:, $type) {...} + our Str multi method perl ( Object $o: ) is export {...} + our multi method warn ( Object $o: ) is export {...} + } + =over +=item defined + + our Bool multi defined ( Any $thing ) + our Bool multi defined ( Any $thing, ::role ) + our Bool multi method defined ( Any $self) + our Bool multi method defined ( Any $self, ::role ) + +C<defined> returns true if the parameter has a value and that value is +not the undefined value (per C<undef>), otherwise false is returned. + +Same as Perl 5, only takes extra optional argument to ask if value is defined +with respect to a particular role: + + defined($x, SomeRole); + +A value may be defined according to one role and undefined according to another. +Without the extra argument, defaults to the definition of defined supplied by +the type of the object. + +=item undefine + + our multi undefine( Any $thing ) + our multi method undefine( Any $self ) + +Takes any variable as a parameter and attempts to "remove" its +definition. For simple scalar variables this means assigning +the undefined value to the variable. For objects, this is equivalent +to invoking their undefine method. For arrays, hashes and other +complex data, this might require emptying the structures associated +with the object. + +In all cases, calling C<undefine> on a variable +should place the object in the same state as if it was just +declared. + =item eqv our Bool multi sub eqv (Ordering @by, $a, $b) @@ -103,6 +160,21 @@ =back +=head1 Pattern + + role Pattern { + method ACCEPTS($self:, $other) {...} + method REJECTS($self:, $other) {...} + } + +=item ACCEPTS + +Used in smartmatching; see S03. + +=item REJECTS + +Used in smartmatching; see S03. + =head1 Additions Please post errors and feedback to perl6-language. If you are making Modified: docs/Perl6/Spec/S32-setting-library/Scalar.pod =================================================================== --- docs/Perl6/Spec/S32-setting-library/Scalar.pod 2009-03-05 03:54:17 UTC (rev 25697) +++ docs/Perl6/Spec/S32-setting-library/Scalar.pod 2009-03-05 05:58:38 UTC (rev 25698) @@ -33,38 +33,6 @@ =over -=item defined - - our Bool multi defined ( Any $thing ) - our Bool multi defined ( Any $thing, ::role ) - -C<defined> returns true if the parameter has a value and that value is -not the undefined value (per C<undef>), otherwise false is returned. - -Same as Perl 5, only takes extra optional argument to ask if value is defined -with respect to a particular role: - - defined($x, SomeRole); - -A value may be defined according to one role and undefined according to another. -Without the extra argument, defaults to the definition of defined supplied by -the type of the object. - -=item undefine - - our multi undefine( Any $thing ) - -Takes any variable as a parameter and attempts to "remove" its -definition. For simple scalar variables this means assigning -the undefined value to the variable. For objects, this is equivalent -to invoking their undefine method. For arrays, hashes and other -complex data, this might require emptying the structures associated -with the object. - -In all cases, calling C<undefine> on a variable -should place the object in the same state as if it was just -declared. - =item undef constant Scalar Scalar::undef