Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Document .VAR
  • Loading branch information
Mouq committed Nov 13, 2014
1 parent 1fa6313 commit e459ac8
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion lib/Language/mop.pod
Expand Up @@ -2,11 +2,23 @@
=TITLE Meta-Object Protocol
=SUBTITLE Introspection and the Perl 6 Object System
TODO
=head1 Metamethods
TODO
These are introspective macros that resemble method calls.
Note that if you want to call a method by the same name of an object, use
quotes around the method name to call it indirectly:
class MY-CLASSES-ARE-ALL-CAPS {
method WHY { "I DON'T KNOW" }
}
my $c = MY-CLASSES-ARE-ALL-CAPS.new;
say $c.WHY # "(MY-CLASSES-ARE-ALL-CAPS)"
say $c."WHY"() # "I DON'T KNOW"
=head2 X<WHAT|syntax,WHAT>
Expand Down Expand Up @@ -40,4 +52,11 @@ The object has a valid concrete representation.
Returns the underlying C<Scalar> object, if there is one.
The presence of a C<Scalar> object indicates that the object is "itemized".
.say for (1, 2, 3); # not itemized, so "1\n2\n3\n"
.say for [1, 2, 3]; # itemized, so "1 2 3\n"
say (1, 2, 3).VAR ~~ Scalar; # False
say [1, 2, 3].VAR ~~ Scalar; # True
=end pod

0 comments on commit e459ac8

Please sign in to comment.