[ruby-core:75545] [Ruby trunk Feature#5899] chaining comparsions.

From: matz@...
Date: 2016-05-17 06:59:28 UTC
List: ruby-core #75545
Issue #5899 has been updated by Yukihiro Matsumoto.

Description updated

I don't think it's worth adding extra complexity to Ruby.

Matz.


----------------------------------------
Feature #5899: chaining comparsions.
https://bugs.ruby-lang.org/issues/5899#change-58676

* Author: Ondrej Bilka
* Status: Feedback
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
Migration from python to ruby is problematic because ruby lacks certain features.
Most important python advantage is chained comparison
We must wrap every comparison like described below.

puts "yes" if 1<2<3<4

class Fixnum
  def <(a)
    ((self<=>a)==-1)&&a
  end
end
class FalseClass
  def <(a)
    false
  end
end





-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread