Skip to content

Commit

Permalink
Various missing item and hash contextualization bits.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Mar 20, 2010
1 parent 7ccf148 commit 3075a5f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/builtins/Parcel.pir
Expand Up @@ -53,6 +53,15 @@ A Parcel in item context becomes a Seq.
.end


=item hash()

=cut

.sub 'hash' :method
.tailcall 'hash'(self)
.end


=item iterator()

Construct an iterator for the Parcel.
Expand Down
5 changes: 5 additions & 0 deletions src/core/Mu.pm
@@ -1,6 +1,11 @@
augment class Mu {
method Bool { $.defined }

method item {
# This is overridden by non-items.
self;
}

multi method notdef() { !self.defined; }

multi method perl {
Expand Down
10 changes: 10 additions & 0 deletions src/core/operators.pm
Expand Up @@ -243,6 +243,16 @@ our sub WHAT(\$x) {
$x.WHAT
}

our multi sub item(*@values) {
@values.Seq
}
our multi sub item(@values) {
@values.Seq
}
our multi sub item($item) {
$item
}

class Whatever { ... }

# the magic one that handles stuff like
Expand Down

0 comments on commit 3075a5f

Please sign in to comment.