Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
API cleanup; avoid some is-* and other not.
  • Loading branch information
jnthn committed Nov 25, 2015
1 parent fd732ce commit 0a8ab76
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions src/core/Supply.pm
Expand Up @@ -24,9 +24,9 @@ my class Tap {
# category theorist. :-))
my role Tappable {
method tap() { ... }
method is-live() { ... } # Taps into a live data source
method is-serial() { ... } # Promises no concurrent emits
method is-sane() { ... } # Matches emit* [done|quit] grammar
method live() { ... } # Taps into a live data source
method serial() { ... } # Promises no concurrent emits
method sane() { ... } # Matches emit* [done|quit] grammar
}

# A few Supply-related exception types.
Expand Down Expand Up @@ -64,8 +64,8 @@ my class Supply {
}
submethod BUILD(:$!tappable!) {}

method live(Supply:D:) { $!tappable.is-live }
method serial(Supply:D:) { $!tappable.is-serial }
method live(Supply:D:) { $!tappable.live }
method serial(Supply:D:) { $!tappable.serial }

my \NOP = -> {};
my \DEATH = -> $ex { $ex.throw };
Expand Down Expand Up @@ -97,9 +97,9 @@ my class Supply {
Tap.new(&!closing)
}

method is-live() { False }
method is-sane() { True }
method is-serial() { True }
method live() { False }
method sane() { True }
method serial() { True }
}.new(:&producer, :&closing, :$scheduler))
}

Expand Down Expand Up @@ -130,9 +130,9 @@ my class Supply {
Tap.new({ $cancellation.cancel })
}

method is-live { False }
method is-sane { True }
method is-serial { False }
method live { False }
method sane { True }
method serial { False }
}.new(:$interval, :$delay, :$scheduler));
}

Expand All @@ -146,9 +146,9 @@ my class Supply {
has $!source;
has $!source-tap;
has int $!cleaned-up;
method is-live() { $!source.is-live }
method is-sane() { True }
method is-serial() { True }
method live() { $!source.live }
method sane() { True }
method serial() { True }
method !cleanup() {
unless $!cleaned-up {
$!cleaned-up = 1;
Expand All @@ -158,7 +158,7 @@ my class Supply {
}

method serialize(Supply:D:) {
$!tappable.is-serial ?? self !! Supply.new(class :: does SimpleOpTappable {
$!tappable.serial ?? self !! Supply.new(class :: does SimpleOpTappable {
has $!lock = Lock.new;

submethod BUILD(:$!source!) {}
Expand Down Expand Up @@ -186,7 +186,7 @@ my class Supply {
}

method sanitize() {
$!tappable.is-sane ?? self !! Supply.new(class :: does SimpleOpTappable {
$!tappable.sane ?? self !! Supply.new(class :: does SimpleOpTappable {
has int $!finished;

submethod BUILD(:$!source!) {}
Expand Down Expand Up @@ -1377,9 +1377,9 @@ my class Supplier {
}
}

method is-live { True }
method is-serial() { False }
method is-sane() { False }
method live { True }
method serial() { False }
method sane() { False }
}

has $!taplist = TapList.new;
Expand Down Expand Up @@ -1504,9 +1504,9 @@ sub SUPPLY(&block) {
$state.active-taps = ();
}

method is-live { False }
method is-sane { True }
method is-serial { True }
method live { False }
method sane { True }
method serial { True }
}.new(:&block))
}

Expand Down

0 comments on commit 0a8ab76

Please sign in to comment.