Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Hack a Parcel.WHICH solution
Apparently, a Parcel created by the .Parcel method, consists of a ListIter
as its only element.  Upon inspection, this is flattened, causing a problem
with the .WHICH representation, as the immutable Parcel internally mutes.
This fix will just expose the ListIter if the Parcel was created with
.Parcel, and thereby create a WHICH that indicates the inherit mutability
of a Parcel that is created that way.  Suggestions for a better solution
are welcome.
  • Loading branch information
lizmat committed Sep 2, 2014
1 parent a640aab commit 69d7051
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/Parcel.pm
Expand Up @@ -11,8 +11,9 @@ my class Parcel does Positional { # declared in BOOTSTRAP
multi method ACCEPTS(Parcel:D: $topic) { self.list.ACCEPTS($topic) }

multi method WHICH(Parcel:D:) {
$!WHICH //=
self.^name ~ '|' ~ @(self).map( {'(' ~ .VAR.WHICH ~ ')'} ).join;
$!WHICH //= self[0] ~~ ListIter # XXX hacky fix for .Parcel parcels
?? self.^name ~ '|(' ~ self[0].VAR.WHICH ~ ')'
!! self.^name ~ '|' ~ @(self).map( {'(' ~ .VAR.WHICH ~ ')'} ).join;
}
method Parcel() { self }
method Capture() {
Expand Down

0 comments on commit 69d7051

Please sign in to comment.