Skip to content

Instantly share code, notes, and snippets.

@pmichaud
Created March 16, 2013 19:17
Show Gist options
  • Select an option

  • Save pmichaud/5177871 to your computer and use it in GitHub Desktop.

Select an option

Save pmichaud/5177871 to your computer and use it in GitHub Desktop.
pmichaud@kiwi:~/p6/rakudo$ git diff src/core/Range.pm
diff --git a/src/core/Range.pm b/src/core/Range.pm
index f94036a..6c061a6 100644
--- a/src/core/Range.pm
+++ b/src/core/Range.pm
@@ -1,3 +1,5 @@
+my class X::Range::InvalidArg { ... }
+
class Range is Iterable is Cool does Positional {
has $.min;
has $.max;
@@ -23,7 +25,9 @@ class Range is Iterable is Cool does Positional {
multi method new(Whatever $min, Whatever $max, :$excludes_min, :$excludes_m
fail "*..* is not a valid range";
}
-
+ multi method new($min, Range $max, :$excludes_min, :$excludes_max) {
+ X::Range::InvalidArg.new(got => $max).throw;
+ }
submethod BUILD($min, $max, $excludes_min, $excludes_max) {
$!min = $min;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment