[#53893] [ruby-trunk - Bug #8204][Open] ObjectSpace.each_object(Bignum) can generate Bignums that are to small to be Bignums — "Hanmac (Hans Mackowiak)" <hanmac@...>
[#53914] [ruby-trunk - Feature #8206][Open] Should Ruby core implement String#blank? — "sam.saffron (Sam Saffron)" <sam.saffron@...>
[#53922] [ruby-trunk - Bug #8208][Open] Raise cached exceptions for nonblocking IO to avoid allocation/stack-copying costs — "headius (Charles Nutter)" <headius@...>
"headius (Charles Nutter)" <headius@headius.com> wrote:
[#53950] [ruby-trunk - Bug #8211][Open] Performance regression of method calls — "dunric (David Unric)" <dunric29a@...>
[#53974] [ruby-trunk - Feature #8215][Open] Support accessing Fiber-locals and backtraces for a Fiber — "halorgium (Tim Carey-Smith)" <ruby-lang-bugs@...>
[#54023] [ruby-trunk - Feature #8223][Open] Make Matrix more omnivorous. — "boris_stitnicky (Boris Stitnicky)" <boris@...>
[#54031] Question about r39944 — Aaron Patterson <tenderlove@...>
Hi,
Even if test directory should be on the load path on test-all, you should
[#54095] [ruby-trunk - Feature #8237][Open] Logical method chaining via inferred receiver — "wardrop (Tom Wardrop)" <tom@...>
[#54175] [ruby-trunk - Bug #8254][Open] Ruby segfaults on second SystemStackError from parser — "charliesome (Charlie Somerville)" <charlie@...>
[#54185] [CommonRuby - Feature #8257][Open] Exception#cause to carry originating exception along with new one — "headius (Charles Nutter)" <headius@...>
(2013/04/12 1:40), headius (Charles Nutter) wrote:
On Sat, Apr 27, 2013 at 5:19 PM, SASADA Koichi <ko1@atdot.net> wrote:
[#54196] Encouraging use of CommonRuby — Charles Oliver Nutter <headius@...>
I think we need to do more to encourage the use of the CommonRuby
Hi,
As far as I understand, what is CommonRuby and the process over CommonRuby
On Thu, Apr 11, 2013 at 11:25 PM, NARUSE, Yui <naruse@airemix.jp> wrote:
(2013/04/12 16:40), Charles Oliver Nutter wrote:
On Fri, Apr 12, 2013 at 8:08 AM, NARUSE, Yui <naruse@airemix.jp> wrote:
[#54201] Has ObjectSpace changed recently? — Dave Thomas <dave@...>
I just noticed that in 2.0, I see this:
[#54207] [CommonRuby - Feature #8258][Open] Dir#escape_glob — "steveklabnik (Steve Klabnik)" <steve@...>
[#54218] [CommonRuby - Feature #8259][Open] Atomic attributes accessors — "funny_falcon (Yura Sokolov)" <funny.falcon@...>
Issue #8259 has been updated by Charles Nutter.
I'm not sure if setting the attribute on the ivar is a good way to go.
[#54333] Requesting Commit Access — Aman Gupta <ruby@...1.net>
Hello ruby-core,
Hi,
[#54415] [ruby-trunk - Bug #8286][Open] Can't decode non-MIME Base64 — "adacosta (Alan Da Costa)" <alandacosta@...>
[#54459] [CommonRuby - Feature #8291][Open] Allow retrieving the root Fiber of a Thread — "halorgium (Tim Carey-Smith)" <ruby-lang@...>
[#54473] [Backport 200 - Backport #8299][Open] Minor error in float parsing — "bobjalex (Bob Alexander)" <bobjalex@...>
[#54509] [ruby-trunk - Bug #8310][Open] resque-web crashes with segfault on Ruby 2.0.0-p0 only, Resque 1.24.1, Redis 2.6.12 — "vaharoni (Amit Aharoni)" <amit.sites@...>
[#54559] [ruby-trunk - Feature #8321][Open] Ripper: I would like coordinates for keywords — "ericp (Eric Promislow)" <eric.promislow@...>
[#54606] Plan to the first 2.0.0 patchlevel release. — Tomoyuki Chikanaga <nagachika00@...>
Hello, Rubyists.
Hi,
Could you please backport the following:
[#54621] [ruby-trunk - Feature #8339][Open] Introducing Geneartional Garbage Collection for CRuby/MRI — "ko1 (Koichi Sasada)" <redmine@...>
(2013/04/28 9:23), authorNari (Narihiro Nakamura) wrote:
2013/4/28 SASADA Koichi <ko1@atdot.net>:
(2013/05/04 12:08), Narihiro Nakamura wrote:
2013/5/4 SASADA Koichi <ko1@atdot.net>:
(2013/05/06 11:50), Tanaka Akira wrote:
2013/5/6 SASADA Koichi <ko1@atdot.net>:
On Sat, Apr 27, 2013 at 8:19 PM, ko1 (Koichi Sasada)
(2013/04/28 21:40), Magnus Holm wrote:
(2013/04/28 23:34), SASADA Koichi wrote:
On Sun, Apr 28, 2013 at 6:07 PM, SASADA Koichi <ko1@atdot.net> wrote:
(2013/04/29 1:19), Magnus Holm wrote:
On Sun, Apr 28, 2013 at 6:29 PM, SASADA Koichi <ko1@atdot.net> wrote:
"ko1 (Koichi Sasada)" <redmine@ruby-lang.org> wrote:
[#54665] [ruby-trunk - Bug #8344][Open] Status of Psych and Syck — "Eregon (Benoit Daloze)" <redmine@...>
[ruby-core:54117] [ruby-trunk - Feature #8223] Make Matrix more omnivorous.
Issue #8223 has been updated by boris_stitnicky (Boris Stitnicky).
marcandre (Marc-Andre Lafortune) wrote:
>
> If you stick with Metre class, like in this example, then coerce 0/1 to a homemade Scalar class (like Matrix does).
> If you go for the more generic MagnitudeWithUnit, then coerce it to MagnitudeWithUnit(0, SCALAR) or something.
> In both cases, it should work fine.
I'll take a look at that Scalar, thanks.
> Still, if you want to be serious about your library, 0 + 42.some_unit should work, and this is what you should focus on.
I want to be serious about my library. I want to make it the best of something like 5 other Ruby unit libraries out there.
I must admit that pragmatically, it saves keystrokes in the interactive mode, if the user is allowed to type
7.m.s竅サツケ + 1 #=> 8.m竅サツケ
rather than of having to tediously type
7.m.s竅サツケ + 1.m.s竅サツケ
It is a perilous feature, because the user needs to keep in mind...
7.km.h竅サツケ + 1 #=> 10.6.km.h竅サツケ
...what the standard unit of speed is 1.m.s竅サツケ, not 1.km.h竅サツケ. I still want
to have this feature, but keep it optional, only when the user explicitly
turns it on. The biggest problem with this feature is the necessary coerce
behavior, which will have to return an advanced object with operator-specific
behavior (#+, #-, #*, #/, #**, #== and whatnot) defined. I'll focus on this
in the near future.
It would seem that with 0, there would be no such problems, because
`something + 0` is always `something`. But unfortunately, this does not
hold well with units that have offsets, such as Celsius degrees. So the
user would still have to keep in mind that 0 in the context of temperatures
means 0.K rather than 0.ツーC. (Of course, filling matrix with Celsius
temperatures is out of question, because only kelvins support addition,
celsius + kelvins give celsius and celsius + celsius raise QuantityError.)
----------------------------------------
Feature #8223: Make Matrix more omnivorous.
https://bugs.ruby-lang.org/issues/8223#change-38368
Author: boris_stitnicky (Boris Stitnicky)
Status: Open
Priority: Low
Assignee: marcandre (Marc-Andre Lafortune)
Category: lib
Target version:
Let's imagine a class Metre, whose instances represent physical magnitudes in metres.
class Metre
attr_reader :magnitude
def initialize magnitude; @magnitude = magnitude end
def to_s; magnitude.to_s + ".m" end
end
Let's say that metres can be multiplied by a number:
class Metre
def * multiplicand
case multiplicand
when Numeric then Metre.new( magnitude * multiplicand )
else
raise "Metres can only be multiplied by numbers, multiplication by #{multiplicand.class} attempted!"
end
end
end
And that they can be summed up with other magnitudes in metres, but, as a feature,
not with numbers (apples, pears, seconds, kelvins...).
class Metre
def + summand
case summand
when Metre then Metre.new( magnitude + summand.magnitude )
else
raise "Metres can only be summed with metres, summation with #{summand.class} attempted!"
end
end
end
Now with one more convenience constructor Numeric#m:
class Numeric
def m; Metre.new self end
end
We can write expressions such as
3.m + 5.m
#=> 8.m
3.m * 2
#=> 6.m
And with defined #coerce:
class Metre
def coerce other; [ self, other ] end
end
Also this expression is valid:
2 * 3.m
#=> 6.m
Before long, the user will want to make a matrix of magnitudes:
require 'matrix'
mx = Matrix.build 2, 2 do 1.m end
#=> Matrix[[1.m, 1.m], [1.m, 1.m]]
It works, but the joy does not last long. The user will fail miserably if ze wants to perform matrix multiplication:
cv = Matrix.column_vector [1, 1]
mx * cv
#=> RuntimeError: Metres can only be summed with metres, summation with Fixnum attempted!
# where 2.m would be expected
In theory, everything should be O.K., since Metre class has both metre summation and multiplication by a number defined. The failure happens due to the internal workings of the Matrix class, which assumes that the elements can be summed together with numeric 0. But it is a feature of metres, that they are picky and allow themselves to be summed only with other Metre instances.
In my real physical units library that I have written, I have solved this problem by
defining an テシber zero object that produces the expected result, when summed with objects, that would otherwise not lend themselves to summation with ordinary numeric 0,
and patching the Matrix class so that it uses this テシber zero instead of the ordinary one.
But this is not a very systematic solution. Actually, I think that the Matrix class would be more flexible, if, instead of simply using 0, it asked the elements of the matrix what their zero is, as in:
class << Metre
def zero; new 0 end
end
But of course, that would also require that ordinary numeric classes can tell what their zero is, as in:
def Integer.zero; 0 end
def Float.zero; 0.0 end
def Complex.zero; Complex 0.0, 0.0 end
# etc.
I think that this way of doing things (that is, having #zero methods in numeric classes and making Matrix actually require the class of the objects in it to have public class method #zero defined) would make everything more consistent and more algebra-like. I am having this problem for already almost half a year, but I only gathered courage today to encumber you guys with this proposal. Please don't judge me harshly for it. I have actually already seen something like this, in particular with bigdecimal's Jacobian (http://ruby-doc.org/stdlib-2.0/libdoc/bigdecimal/rdoc/Jacobian.html), which requires that the object from which the Jacobian is computed implements methods #zero, #one, #two etc. Sorry again.
--
http://bugs.ruby-lang.org/