Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
document barewords
  • Loading branch information
moritz committed Apr 4, 2015
1 parent f3008c5 commit aeaa776
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions lib/Language/syntax.pod
Expand Up @@ -154,6 +154,8 @@ expressions. Examples for terms are variables (C<$x>), barewords such as type
names (C<Int>), literals (C<42>), declarations (C<sub f() { }>) and calls
(C<f()>).
For example, in the expression C<2 * $salary>, C<2> and C<$salary> are two
terms (an L<integer|/type/Int> literal and a L<variable|/language/variables>).
=head2 Variables
Expand All @@ -168,11 +170,31 @@ them.
See the L<documentation on variables|/language/variables> for more details.
=begin comment
=head2 Barewords (Constants, Type Names)
TODO
Pre-declared identifiers can be terms on their own. Those are typically type
names or constants, but also the term C<self> which refers to an objectt that
a method was called on (see L<objects|/language/objects>), and sigilles
variables:
say Int; # (Int)
# ^^^ type name (built in)
constant answer = 42;
say answer;
# ^^^^^^ constant
class Meta {
method type-name {
self.^name;
# ^^^^ built-in term 'self'
}
}
say Meta.type-name; # Meta
# ^^^^ type name
=begin comment
=head2 Literals
Expand Down

0 comments on commit aeaa776

Please sign in to comment.