[#45382] [ruby-trunk - Feature #6530][Open] Improve Racc documentation coverage — "zzak (Zachary Scott)" <zachary@...>
5 messages
2012/06/02
[#45431] [ruby-trunk - Bug #6548][Open] Rake doesn't ignore arguments after -- — "rosenfeld (Rodrigo Rosenfeld Rosas)" <rr.rosas@...>
12 messages
2012/06/05
[#45441] [ruby-trunk - Bug #6550][Open] crash 1.9.3 — "mrbrdo (Jan Berdajs)" <mrbrdo@...>
8 messages
2012/06/06
[#45442] 1.8.7 to come this month — Urabe Shyouhei <shyouhei@...>
Hello. As I wrote before I will release a 1.8.7 patchlevel in this month.
5 messages
2012/06/06
[#45474] [ANN] Request for "slide-show" of your feature proposal — Yusuke Endoh <mame@...>
(Japanese later; 日本語が後にあります)
18 messages
2012/06/07
[#46009] Re: [ANN] Request for "slide-show" of your feature proposal
— Aaron Patterson <tenderlove@...>
2012/06/30
On Thu, Jun 07, 2012 at 11:59:12PM +0900, Yusuke Endoh wrote:
[#45483] Re: [ANN] Request for "slide-show" of your feature proposal
— Rodrigo Rosenfeld Rosas <rr.rosas@...>
2012/06/07
Is this what you were talking about?
[#46332] Re: [ANN] Request for "slide-show" of your feature proposal
— Roger Pack <rogerdpack2@...>
2012/07/11
> * at most THREE proposals per person
[#45552] [ruby-trunk - Bug #6571][Assigned] Time.mktime Y2K38 problem on 1.9.3p125 i386-mingw32 — "MartinBosslet (Martin Bosslet)" <Martin.Bosslet@...>
10 messages
2012/06/10
[#45563] [ruby-trunk - Bug #6573][Open] Webrick test failures — "bkabrda (Bohuslav Kabrda)" <bkabrda@...>
19 messages
2012/06/11
[#45589] Developers' meeting (7/21) — Yusuke Endoh <mame@...>
Hello, committers
10 messages
2012/06/12
[#45623] Re: Developers' meeting (7/21)
— Yusuke Endoh <mame@...>
2012/06/13
Four seats are now left.
[#45647] [ruby-trunk - Bug #6592][Open] test_call_double(DL::TestDL) fails on ARM HardFP — "vo.x (Vit Ondruch)" <v.ondruch@...>
15 messages
2012/06/14
[#45664] [ruby-trunk - Bug #6596][Open] New method for Arrays : Array#index — "robin850 (Robin Dupret)" <robin.dupret@...>
20 messages
2012/06/15
[#45694] [ruby-trunk - Feature #6602][Open] Tail call optimization: enable by default? — "ko1 (Koichi Sasada)" <redmine@...>
12 messages
2012/06/18
[#45715] [ruby-trunk - Feature #6609][Open] Toplevel as self extended module — "trans (Thomas Sawyer)" <transfire@...>
17 messages
2012/06/19
[#45732] [ruby-trunk - Bug #6614][Open] GC doesn't collect objects bound to (collectable) proc — "rogerdpack (Roger Pack)" <rogerpack2005@...>
9 messages
2012/06/20
[#45735] [ruby-trunk - Bug #6616][Open] MinGW: cannot build extensions or run tests due changes in exec_arg? — "luislavena (Luis Lavena)" <luislavena@...>
9 messages
2012/06/21
[#45749] [ruby-trunk - Bug #6616] MinGW: cannot build extensions or run tests due changes in exec_arg?
— "phasis68 (Heesob Park)" <phasis@...>
2012/06/21
[#45785] How can I contribute? — David Albert <davidbalbert@...>
Hello ruby-core,
6 messages
2012/06/22
[#45798] [ruby-trunk - Bug #6634][Open] Deadlock with join and ConditionVariable — "meh. (meh. I don't care)" <meh@...>
20 messages
2012/06/23
[#45805] [ruby-trunk - Feature #6636][Open] Enumerable#size — "marcandre (Marc-Andre Lafortune)" <ruby-core@...>
15 messages
2012/06/23
[#45822] [ruby-trunk - Feature #6641][Open] Hash.auto constructor — "trans (Thomas Sawyer)" <transfire@...>
9 messages
2012/06/25
[#45864] [ruby-trunk - Bug #6647][Open] Exceptions raised in threads should be logged — "headius (Charles Nutter)" <headius@...>
71 messages
2012/06/25
[#45866] [ruby-trunk - Bug #6647] Exceptions raised in threads should be logged
— "rue (Eero Saynatkari)" <redmine@...>
2012/06/25
[#45878] [ruby-trunk - Feature #6649][Open] Add new set_trace_func events "b-call", "b-return" — "ko1 (Koichi Sasada)" <redmine@...>
8 messages
2012/06/26
[#45887] [ruby-trunk - Bug #6650][Open] Fixing win32ole test errors — bosko (Boško Ivanišević) <bosko.ivanisevic@...>
10 messages
2012/06/26
[#45916] [ruby-trunk - Bug #6656][Open] Time#strftime('%Z') should return 'UTC' instead of 'GMT' — "stomar (Marcus Stollsteimer)" <redmine@...>
6 messages
2012/06/27
[#45922] Re: [ruby-trunk - Bug #6656][Open] Time#strftime('%Z') should return 'UTC' instead of 'GMT'
— Tanaka Akira <akr@...>
2012/06/28
2012/6/27 stomar (Marcus Stollsteimer) <redmine@ruby-lang.org>:
[#45935] Re: [ruby-trunk - Bug #6656][Open] Time#strftime('%Z') should return 'UTC' instead of 'GMT'
— Marcus Stollsteimer <sto.mar@...>
2012/06/28
Am 28.06.2012 02:29, schrieb Tanaka Akira:
[#45940] Re: [ruby-trunk - Bug #6656][Open] Time#strftime('%Z') should return 'UTC' instead of 'GMT'
— Tanaka Akira <akr@...>
2012/06/28
2012/6/28 Marcus Stollsteimer <sto.mar@web.de>:
[#45925] Commit bit in GitHub mirror? — Luis Lavena <luislavena@...>
Hello,
6 messages
2012/06/28
[#45926] Re: Commit bit in GitHub mirror?
— Urabe Shyouhei <shyouhei@...>
2012/06/28
Hello, this is svn -> git gateway admin.
[#45958] [ruby-trunk - Feature #6668][Open] Multiple assignment should not return an Array object — "headius (Charles Nutter)" <headius@...>
7 messages
2012/06/29
[#47584] [ruby-trunk - Feature #6668] Multiple assignment should not return an Array object
— "headius (Charles Nutter)" <headius@...>
2012/09/19
[#45960] [ruby-trunk - Feature #6669][Open] A method like Hash#map but returns hash — "yhara (Yutaka HARA)" <redmine@...>
18 messages
2012/06/29
[#45983] [ruby-trunk - Bug #6675][Open] Raise exception when convert encoding of a character from GBK to UTF — "mghomn (Justin Peal)" <yujianbin@...>
5 messages
2012/06/30
[#46020] [ruby-trunk - Feature #6678][Open] Precedence of ^ operator — "trans (Thomas Sawyer)" <transfire@...>
6 messages
2012/06/30
[#46021] [ruby-trunk - Feature #6679][Open] Default Ruby source file encoding to utf-8 — "claytrump (Clay Trump)" <clay.trump@...>
21 messages
2012/06/30
[#46080] [ruby-trunk - Feature #6679][Assigned] Default Ruby source file encoding to utf-8
— "mame (Yusuke Endoh)" <mame@...>
2012/07/01
[#46653] [ruby-trunk - Feature #6679] Default Ruby source file encoding to utf-8
— "mame (Yusuke Endoh)" <mame@...>
2012/07/23
[ruby-core:45507] [ruby-trunk - Feature #6555] New comparison operators
From:
jEFF (Jean-François Berroyer) <jfberroyer@...>
Date:
2012-06-08 12:19:33 UTC
List:
ruby-core #45507
Issue #6555 has been updated by jEFF (Jean-Fran巽ois Berroyer).
=begin
I understand your hesitation in adding 8 more operators. It is not a little change. I am also aware that in Ruby, we can do without operators since methods can fit everywhere we use operators.
I really appreciate that in Ruby, operators are methods with just an alternative syntax, and that there is not another concept behind them, because there is no need.
What I like with operators is that they make expressions close to mathematical notation, and often, mathematical notation is close to the concept it express.
When you write an equality with (({a == b})), you can see graphically that the relation is symetric, much more than in expressions like (({a.eql?(b)})). You can also see the antisymmetry in expressions like (({a < b})) or like (({a > b})).
The (({!})) prefix before an operator is for me just like a strike through the operator, like we do in mathematical notation.
Moreover, we are often hesitating on names when using methods rather than operators. (({equal?})), (({less_than?})), (({greater_than?})) etc. are often too long, especially when used in complex expressions. We can use abbreviations like (({eql?})), (({gt?})) or (({lt?})), but doing this, the code is often less easy to read and to write (What does this abbreviation mean? What is the abbreviation for that?). That's also why I like operators. Their meanings are immediate because they are graphical and not linked with a language like english.
But I'm also very careful in using them, and I admit that very often, defining a method is a better choice than defining an operator. However, operators are for me the best solution for Comparable module.
I found it wonderful that the Comparable module provide all the comparison operators as soon as we have defined the (({<=>})) method (one to rule them all). But I don't like to use directly (({<=>})) in my code because its return values -1, 0, 1 and nil are just conventional (even if they are logical).
When I look at the documentation of Comparable module about (({<=>})) method, I have the impression that nil value is not considered like the other return values, but more like an exceptional one. I think it souldn't be.
The concept of "comparable" in Ruby is for me directly connected with the mathematical concept of "order". In mathematics, there are partial orders and total orders, and a total order is just a particular partial order. So partial orders are more general than total orders. I think current Comparable module is perfect to work with total orders, but there are some missing things to work with partial orders, even if (({<=>})) returns four different values. Adding (({<>})) and (({><})) methods would help us to work with partial orders by getting the Comparable module more general.
I had a little hesitation with (({<>})) and (({><})), that would be new conventional notations. I hesitated in inverting the meaning of those two, but since in some other languages (({<>})) is used to express that two things are different, I think it is ok if (({<>})) means in Ruby "comparably different". About the (({><})) notation for "uncomparable", I don't have any strong argument, but I would just note that it doesn't need another character than those that are currently used in comparison operators.
I also think that systematic use of (({!})) prefix to have the negative form of a comparison operator is simple and logical and would also be a generalisation of what already exists.
Finaly, I would like to note that all these new operators would not change anything in the current Ruby way : as long as you work with a total order, like with numbers natural order, or just with equivalence relations, there is no need to care about the new operators and you can programm just like before. But if you have to work with partial order, you will find those new operators very useful.
The only bad thing I think about is that introducing these new operators would involve that we will be able to define a lot of new operators in any class, and I think using them without Comparable module and giving them other arbitrary meanings could be a real bad thing. But is it Ruby's care to prevent users from doing bad things with Ruby?
The decision of adding all that stuff in Ruby is not a little one, because adding operators involves add-ons in Ruby's syntax. This idea has to be discuted, but I think it could be really interresting and that is why I wanted to propose it to the community.
jEFF
=end
----------------------------------------
Feature #6555: New comparison operators
https://bugs.ruby-lang.org/issues/6555#change-27094
Author: jEFF (Jean-Fran巽ois Berroyer)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version: 2.0.0
=begin
x <=> y returns -1, 0, 1 or nil
(x <=> y) == -1 means "x less than y" and is the same as x < y
(x <=> y) == 0 means "x equal y" is the same as x == y
(x <=> y) == 1 means "x greater than y" and is the same as x > y
(x <=> y) == nil means "x not comparable with y" and is the same as !(x <=> y)
We see there is no short syntax to test if two objects are not comparable.
Can we have something like (({x >< y})), provided by (({Comparable})) module, that would mean "x and y are not comparable" ?
As (({x != y})) is a short syntax for (({!(x == y)})), can we have (({x !< y})) for (({!(x < y)})) and (({x !<= y})) for (({!(x <= y)})) and so on ?
As (({x <= y})) is the same as (({(x < y or x == y)})), can we have (({x <> y})) for (({(x < y or x > y)})) ?
Here is a list of all possible comparison operators there could be (and their meanings) :
< return true when <=> return -1 ("less than")
== return true when <=> return 0 ("egal")
> return true when <=> return 1 ("greater than")
<= return true when <=> return -1 or 0 ("equal or less than")
>= return true when <=> return 1 or 0 ("equal or greater than")
<> return true when <=> return 1 or -1 ("less or greater than" that is to say "comparable and different")
>< return true when <=> return nil ("not comparable")
!< return true when <=> return 0 or 1 or nil ("not less than", that is different from "greater than or eqal" that involves "comparable")
!= return true when <=> return -1 or 1 or nil ("not equal", that is different from "less or greater than" that involves "comparable")
!> return true when <=> return -1 or 0 or nil ("not greater than", that is different from "less than or eqal" that involves "comparable")
!<= return true when <=> return nil or 1 ("not equal nor less than", that is different from "greater than" that involves "comparable")
!>= return true when <=> return nil or -1 ("not equal nor greater than", that is different from "less than" that involves "comparable")
!<> return true when <=> return 0 or nil ("not less nor greater than", that is different from "egal" that involves "comparable")
!>< return true when <=> return -1 or 0 or 1 ("not not comparable" or just "comparable", the same as <=> but returning a boolean)
All these operators would be very useful, especially when working with partial orders (like subset-inclusion for exemple).
Perhaps (({x !== y})) should also be a short syntax for (({!(x === y)})).
=end
--
http://bugs.ruby-lang.org/