Browse files

Don't special case X.===

It's quite confusing to understand why X === should be different from
X.class ===.

Maybe a better way to do this would be to use arity, but that sounds
even more confusing, so seems best to just remove the special case for
now.
  • Loading branch information...
1 parent 90bc363 commit 0cd510377cde6f15cdd3fce00f0550a9d698a2e2 @ConradIrwin ConradIrwin committed Sep 27, 2012
Showing with 0 additions and 22 deletions.
  1. +0 −9 README.markdown
  2. +0 −3 lib/ampex.rb
  3. +0 −10 spec/ampex_spec.rb
View
9 README.markdown
@@ -73,15 +73,6 @@ Secondly, other arguments or operands will only be evaluated once, and not every
[1, 2].map{ |x| x + (i += 1) }
# => [2, 4]
-
-Thirdly, `#===` only works on `X` itself.
-
- # Correct
- [1,2,3].map(&X === 2) #=> [false, true, false]
-
- # Wrong:
- [1,2,3].map(&X.class === Fixnum) #! raises an exception
-
Epilogue
--------
View
3 lib/ampex.rb
@@ -60,6 +60,3 @@ def method_missing(name, *args, &block)
end
X = Metavariable.new
-class << X
- undef ===
-end
View
10 spec/ampex_spec.rb
@@ -56,16 +56,6 @@ def sign_off; "Yours relatedly, Cousin Sybil"; end
end
it "should be a valid target for when" do
-
(X.kind_of?(Numeric) === "String").should be_false
-
- end
-
- it "should not override X#===" do
-
- [1,2,3].map(&X === 2).should == [false, true, false]
-
end
-
-
end

0 comments on commit 0cd5103

Please sign in to comment.