[#98621] Re: Function getlogin_r()'s protoype] — Bertram Scharpf <lists@...>
FYI,
3 messages
2020/06/02
[#98947] [Ruby master Feature#16986] Anonymous Struct literal — ko1@...
Issue #16986 has been reported by ko1 (Koichi Sasada).
66 messages
2020/06/26
[#98962] [Ruby master Bug#16988] Kernel.load loads file from current directory without '.' in path — misharinn@...
Issue #16988 has been reported by TheSmartnik (Nikita Misharin).
5 messages
2020/06/26
[#98969] [Ruby master Feature#16994] Sets: shorthand for frozen sets of symbols / strings — marcandre-ruby-core@...
Issue #16994 has been reported by marcandre (Marc-Andre Lafortune).
7 messages
2020/06/26
[#100117] [Ruby master Feature#16994] Sets: shorthand for frozen sets of symbols / strings
— matz@...
2020/09/25
Issue #16994 has been updated by matz (Yukihiro Matsumoto).
[ruby-core:98970] [Ruby master Feature#16995] Sets: <=> should be specialized
From:
marcandre-ruby-core@...
Date:
2020-06-26 20:43:58 UTC
List:
ruby-core #98970
Issue #16995 has been reported by marcandre (Marc-Andre Lafortune). ---------------------------------------- Feature #16995: Sets: <=> should be specialized https://bugs.ruby-lang.org/issues/16995 * Author: marcandre (Marc-Andre Lafortune) * Status: Open * Priority: Normal ---------------------------------------- This is quite minor, but `Set#<=>` should be refined. Reminder: `Set` defines `<`, `>`, etc. as inclusion, but does not have a corresponding `<=>`: ```ruby Set[1] < Set[1, 2] # => true Set[1] <=> Set[1, 2] # => nil, should be -1 Set[1] <=> Set[2] # => nil, ok, not orderable ``` The official stated reason for `Set` to *not* implement is that some sets are not comparable. That is exactly what `nil` result type is for IMO. Sets are partically ordered and `<=>` should reflect that. https://en.wikipedia.org/wiki/Partially_ordered_set ```ruby Set[1] < Set[1, 2] # => true [Set[1], Set[1, 2]].sort # => ArgumentError, should be [Set[1], Set[1, 2]] [Set[1], Set[2]].sort # => ArgumentError, ok, can't be ordered ``` This is *exactly the same* idea as `Class`, which correctly refines `<=>`: ```ruby Array < Enumerable # => true Array <=> Enumerable # => -1, ok [Array, Enumerable].sort # => [Array, Enumerable] [Array, String].sort # => ArgumentError (comparison of Class with Class failed), ok ``` -- 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>