Actions
Bug #9962
closedNumeric.new
Description
Numeric.new はできないようにしないといけないのでは……。
以前 Numeric の子孫は全部 new を殺したのに、まさかすぎて忘却してたようですね。
これ仕様変更かもしんないけど、backport はすべきなんすかねえ。
Updated by usa (Usaku NAKAMURA) over 10 years ago
- Related to Bug #9961: TracePoint can skip c_return with rb_rescue() added
Updated by ko1 (Koichi Sasada) over 10 years ago
Numeric.new 自体は、
test/ruby/test_numeric.rb に
assert_raise(TypeError) { -Numeric.new }
とあったため、[ruby-trunk - Bug #9961] で利用したのでした。
Updated by akr (Akira Tanaka) almost 10 years ago
ふと検索したところ、Numeric からの継承を使っている gem はそれなりに存在するようです。
(結果を下につけます。スコープの都合により ::Numeric ではないものを参照しているのが混じっているかもしれません。)
Numeric.new をできないようにすると、こういうのは動かなくなるんでしょうか。
もし動かなくなるとしたら、その問題以上の利点が必要だと思いますが、どんな利点があるでしょうか。
M500-0.9.2/lib/M500.rb:644:class Natural < Numeric
M500-0.9.2/lib/M500.rb:1389:class Quotient < Numeric
M500-0.9.2/lib/M500.rb:1692:class Decimal < Numeric
M500-0.9.2/lib/M500.rb:2069:class Fraction < Numeric #Mixed fraction
M500-0.9.2/lib/M500.rb:2647:class Real < Numeric
appmath-0.0.1/lib/cnum.rb:37:class C < Numeric
appmath-0.0.1/lib/rnum.rb:380:class R < Numeric
ardm-0.2.0/lib/ardm/property/decimal.rb:5: class Decimal < Numeric
ardm-0.2.0/lib/ardm/property/float.rb:5: class Float < Numeric
ardm-0.2.0/lib/ardm/property/integer.rb:5: class Integer < Numeric
artoo-1.8.0/lib/artoo/ext/numeric.rb:2:class Integer < Numeric
axiom-0.2.0/lib/axiom/attribute/decimal.rb:7: class Decimal < Numeric
axiom-0.2.0/lib/axiom/attribute/float.rb:7: class Float < Numeric
axiom-0.2.0/lib/axiom/attribute/integer.rb:7: class Integer < Numeric
axiom-0.2.0/lib/axiom/function/numeric/absolute.rb:8: class Absolute < Numeric
axiom-0.2.0/lib/axiom/function/numeric/addition.rb:8: class Addition < Numeric
axiom-0.2.0/lib/axiom/function/numeric/division.rb:8: class Division < Numeric
axiom-0.2.0/lib/axiom/function/numeric/exponentiation.rb:8: class Exponentiation < Numeric
axiom-0.2.0/lib/axiom/function/numeric/modulo.rb:8: class Modulo < Numeric
axiom-0.2.0/lib/axiom/function/numeric/multiplication.rb:8: class Multiplication < Numeric
axiom-0.2.0/lib/axiom/function/numeric/square_root.rb:8: class SquareRoot < Numeric
axiom-0.2.0/lib/axiom/function/numeric/subtraction.rb:8: class Subtraction < Numeric
axiom-0.2.0/lib/axiom/function/numeric/unary_minus.rb:8: class UnaryMinus < Numeric
axiom-0.2.0/lib/axiom/function/numeric/unary_plus.rb:8: class UnaryPlus < Numeric
axiom-types-0.1.1/lib/axiom/types/decimal.rb:7: class Decimal < Numeric
axiom-types-0.1.1/lib/axiom/types/float.rb:7: class Float < Numeric
axiom-types-0.1.1/lib/axiom/types/integer.rb:7: class Integer < Numeric
backports-3.6.3/lib/backports/1.9.2/stdlib/matrix.rb:1426: class Scalar < Numeric # :nodoc:
bahuvrihi-constants-0.1.0/lib/constants/constant.rb:8:class Unit < Numeric
bahuvrihi-molecules-0.2.0/lib/molecules/calc.rb:6:class Unit < Numeric # :nodoc:
bigdecimal-1.2.5/lib/bigdecimal/util.rb:5:class Integer < Numeric
bigdecimal-1.2.5/lib/bigdecimal/util.rb:26:class Float < Numeric
bigdecimal-1.2.5/lib/bigdecimal/util.rb:69:class BigDecimal < Numeric
bigdecimal-1.2.5/lib/bigdecimal/util.rb:105:class Rational < Numeric
caisson-0.0.3/lib/caisson/implants/mongoid.rb:1:class Percent < Numeric
carats-0.3.0/lib/carat-dev/quaternion/quaternion.rb:205:class Quaternion < Numeric
carats-0.3.0/lib/carat/infinity.rb:20:class Infinity < Numeric
cbor-0.5.6.4/doclib/cbor/core_ext.rb:52:class Float < Numeric
cgen-0.16.12/examples/complex.rb:3:class MyComplex < Numeric
cgen-0.16.12/examples/complex2.rb:3:class MyComplex2 < Numeric
cgen-0.16.12/examples/example-ruby-talk-26July2009.rb:3:class Complex < Numeric
cgen-0.16.12/examples/modular-def.rb:69:class MyComplex < Numeric
chrisk-protopuffs-0.3.0/lib/protopuffs/message/field.rb:90: class VarInt < Numeric
chrisk-protopuffs-0.3.0/lib/protopuffs/message/field.rb:133: class Fixed32Base < Numeric
chrisk-protopuffs-0.3.0/lib/protopuffs/message/field.rb:156: class Fixed64Base < Numeric
clj-0.0.8.2/lib/clj/types.rb:190:class BigDecimal < Numeric
closest_fib_gem-0.1.0/lib/closest_fib_gem.rb:7:class Integer < Numeric
coercible-1.0.0/lib/coercible/coercer/decimal.rb:5: class Decimal < Numeric
coercible-1.0.0/lib/coercible/coercer/float.rb:5: class Float < Numeric
coercible-1.0.0/lib/coercible/coercer/integer.rb:5: class Integer < Numeric
concordia-publishing-house-syck-1.0.0.4/test/test_yaml.rb:1352: class NumericTest < Numeric
constants-0.1.1/lib/constants/constant.rb:8:class Unit < Numeric
cssensible-0.3.0/lib/cssensible/em_value.rb:5: class EmValue < Numeric
dead_simple_cms-0.12.7/lib/dead_simple_cms/attribute/type/all.rb:37: class Float < Numeric
dead_simple_cms-0.12.7/lib/dead_simple_cms/attribute/type/all.rb:42: class Integer < Numeric
dec_number-0.2.1/ext/dec_number/_test_numeric.rb:4: class DummyNumeric < Numeric
dm-core-1.2.1/lib/dm-core/property/decimal.rb:3: class Decimal < Numeric
dm-core-1.2.1/lib/dm-core/property/float.rb:3: class Float < Numeric
dm-core-1.2.1/lib/dm-core/property/integer.rb:3: class Integer < Numeric
dyi-1.3.0/lib/ironruby.rb:30:class BigDecimal < Numeric
fiddle-0.6.3/lib/fiddle/data_type.rb:63: class Integer < Numeric
flt-1.3.2/lib/flt/num.rb:143:class Num < Numeric
fort-2.0.6/lib/fort/type.rb:97: class Integer < Numeric
fort-2.0.6/lib/fort/type.rb:103: class Real < Numeric
fort-2.0.6/lib/fort/type.rb:109: class Complex < Numeric
fractional-1.0.1/lib/fractional.rb:4:class Fractional < Numeric
hms-0.0.3/lib/hms/duration.rb:9: class Duration < Numeric
home_run-1.0.9/lib/date.rb:9: class Infinity < Numeric # :nodoc:
huia-0.3.0/lib/huia/ast/float.rb:3: class Float < Numeric
huia-0.3.0/lib/huia/ast/integer.rb:3: class Integer < Numeric
intervals-0.5.83/test/test_interval.rb:563: class PoorMansRational < Numeric
ircsupport-0.2.0/lib/ircsupport/message.rb:48: class Numeric005 < Numeric
ircsupport-0.2.0/lib/ircsupport/message.rb:116: class Numeric353 < Numeric
ircsupport-0.2.0/lib/ircsupport/message.rb:143: class Numeric352 < Numeric
is-fixed-0.2.0/lib/is/fixed.rb:3:class Fixed < Numeric
jvyaml-0.0.1/test/test_yaml_two.rb:1236: class NumericTest < Numeric
km-psych-0.1.0/test/psych/test_yaml.rb:1205: class NumericTest < Numeric
long-decimal-1.00.01/lib/long-decimal.rb:355:class LongDecimalBase < Numeric
mega-0.3.1/lib/mega/infinity.rb:50:class Infinity < Numeric
minad-units-0.1.3/lib/units.rb:4:class Unit < Numeric
molecules-0.2.0/lib/molecules/calc.rb:6:class Unit < Numeric # :nodoc:
momomoto-0.2.1/lib/momomoto/datatype/real.rb:5: class Real < Numeric
mongoid_money-0.2.1/lib/mongoid_money/money.rb:1:class Money < Numeric
motion_coercible-0.2.0.2/lib/project/coercer/decimal.rb:7: class Decimal < Numeric
motion_coercible-0.2.0.2/lib/project/coercer/float.rb:7: class Float < Numeric
motion_coercible-0.2.0.2/lib/project/coercer/integer.rb:8: class Integer < Numeric
msgpack-0.5.9/doclib/msgpack/core_ext.rb:52:class Float < Numeric
mspec-1.5.21/lib/mspec/mocks/proxy.rb:13:class NumericMockObject < Numeric
mudrat_projector-0.9.8/test/test_helper.rb:32:class BigDecimal < Numeric
opal-0.6.2/opal/corelib/complex.rb:1:class Complex < Numeric
opal-0.6.2/opal/corelib/numeric.rb:503:class Integer < Numeric
opal-0.6.2/opal/corelib/numeric.rb:515:class Float < Numeric
opal-0.6.2/opal/corelib/rational.rb:1:class Rational < Numeric
openlogic-rdf-0.3.7/lib/rdf/model/literal/decimal.rb:13: class Decimal < Numeric
openlogic-rdf-0.3.7/lib/rdf/model/literal/double.rb:13: class Double < Numeric
plusminus-0.2.0/lib/plusminus/plusminus_float.rb:1:class Plusminus::PlusminusFloat < Numeric
protopuffs-0.3.0/lib/protopuffs/message/field.rb:90: class VarInt < Numeric
protopuffs-0.3.0/lib/protopuffs/message/field.rb:133: class Fixed32Base < Numeric
protopuffs-0.3.0/lib/protopuffs/message/field.rb:156: class Fixed64Base < Numeric
psych-2.0.6/test/psych/test_yaml.rb:1222: class NumericTest < Numeric
psych-shopifork-2.0.5/test/psych/test_yaml.rb:1222: class NumericTest < Numeric
puppet-3.7.1/lib/puppet/vendor/semantic/lib/semantic/version.rb:7: class Version < Numeric
puppet-3.7.1/lib/semver.rb:6:class SemVer < Numeric
puppet-parse-0.1.0/lib/vendor/semver.rb:6:class SemVer < Numeric
r10k-1.3.4/lib/r10k/semver.rb:7:class SemVer < Numeric
r_type-0.0.3/lib/r_type/type/integer.rb:2: class Integer < Numeric
radix-2.2.0/lib/radix/float.rb:18: class Float < Numeric
radix-2.2.0/lib/radix/integer.rb:15: class Integer < Numeric
radix-2.2.0/lib/radix/rational.rb:15: class Rational < Numeric
radix-firstbanco-2.2.0/lib/radix/float.rb:18: class Float < Numeric
radix-firstbanco-2.2.0/lib/radix/integer.rb:15: class Integer < Numeric
radix-firstbanco-2.2.0/lib/radix/rational.rb:15: class Rational < Numeric
rails-units-1.6.0/lib/rails_units/cache.rb:1:class Unit < Numeric
rails-units-1.6.0/lib/rails_units/unit.rb:35:# class Unit < Numeric
rails-units-1.6.0/lib/rails_units/unit.rb:41:class Unit < Numeric
rails-units-1.6.0/lib/rails_units/unit_definitions.rb:1:class Unit < Numeric
rails-units-1.6.0/lib/rails_units/version.rb:1:class Unit < Numeric
rails-units-1.6.0/test/test_rails-units.rb:17:class Unit < Numeric
ratio-1.0.1/lib/ratio.rb:4:class Ratio < Numeric
rdf-1.1.6/lib/rdf/model/literal/decimal.rb:13: class Decimal < Numeric
rdf-1.1.6/lib/rdf/model/literal/double.rb:13: class Double < Numeric
rhodes-3.5.1.12/lib/extensions/mspec/mspec/mocks/proxy.rb:13:class NumericMockObject < Numeric
rhodes-3.5.1.12/lib/framework/builtinME.rb:528:class Integer < Numeric
rhodes-3.5.1.12/lib/framework/dateOrig.rb:255: class Infinity < Numeric # :nodoc:
rhodes-3.5.1.12/lib/framework/rational18.rb:64:class Rational < Numeric
rhodes-3.5.1.12/lib/framework/rationalME.rb:64:class Rational < Numeric
rhodes-3.5.1.12/platform/shared/xruby/src/builtin.rb:639:class Integer < Numeric
rhodes-3.5.1.12/spec/framework_spec/app/spec/core/math/fixtures/classes.rb:6: class Float < Numeric
rhodes-3.5.1.12/spec/framework_spec/app/spec/core/numeric/fixtures/classes.rb:2: class Comparison < Numeric
rhodes-3.5.1.12/spec/framework_spec/app/spec/core/numeric/fixtures/classes.rb:12: class Subclass < Numeric
rhodes-framework-1.2.1/lib/builtinME.rb:445:class Integer < Numeric
rhodes-framework-1.2.1/lib/date.rb:255: class Infinity < Numeric # :nodoc:
rhodes-framework-1.2.1/lib/rationalME.rb:64:class Rational < Numeric
robject-0.0.2/lib/robject/type/integer.rb:2: class Integer < Numeric
roman-0.2.0/lib/roman.rb:2:class RomanNumeral < Numeric
rsense-core-0.6.6/stubs/1.8/bigdecimal.rb:1:class BigDecimal < Numeric
rsense-core-0.6.6/stubs/1.8/rational.rb:1:class Rational < Numeric
rtanque-0.1.2/lib/rtanque/heading.rb:32: class Heading < Numeric
ruby-mpc-0.0.9/lib/mpc/version.rb:1:class MPC < Numeric
ruby-mpfi-0.0.10/lib/mpfi.rb:4:class MPFI < Numeric
ruby-mpfi-0.0.10/lib/mpfi/matrix.rb:6:class MPFI < Numeric
ruby-mpfi-0.0.10/lib/mpfi/version.rb:1:class MPFI < Numeric
ruby-mpfr-0.0.17/lib/mpfr/matrix.rb:4:class MPFR < Numeric
ruby-mpfr-0.0.17/lib/mpfr/rspec.rb:1:class MPFR < Numeric
ruby-mpfr-0.0.17/lib/mpfr/version.rb:1:class MPFR < Numeric
ruby-units-1.4.5/lib/ruby_units/cache.rb:1:class RubyUnits::Unit < Numeric
ruby-units-1.4.5/lib/ruby_units/definition.rb:1:class RubyUnits::Unit < Numeric
ruby-units-1.4.5/lib/ruby_units/unit.rb:36: class Unit < Numeric
ruby-units-1.4.5/lib/ruby_units/version.rb:2: class Unit < Numeric
ruby-units-brewpoo-1.3.0/lib/ruby_units/complex.rb:1:class Complex < Numeric
ruby-units-brewpoo-1.3.0/lib/ruby_units/ruby-units.rb:35:# class Unit < Numeric
ruby-units-brewpoo-1.3.0/lib/ruby_units/ruby-units.rb:41:class Unit < Numeric
ruby-units-brewpoo-1.3.0/lib/ruby_units/units.rb:3:class Unit < Numeric
ruby-units-brewpoo-1.3.0/test/test_ruby-units.rb:17:class Unit < Numeric
ruby_on_ruby-0.0.1/vendor/javascripts/emscripted-ruby/lib/complex.rb:101:class Complex < Numeric
ruby_on_ruby-0.0.1/vendor/javascripts/emscripted-ruby/lib/date.rb:256: class Infinity < Numeric # :nodoc:
ruby_on_ruby-0.0.1/vendor/javascripts/emscripted-ruby/lib/matrix.rb:876: class Scalar < Numeric # :nodoc:
ruby_on_ruby-0.0.1/vendor/javascripts/emscripted-ruby/lib/rational.rb:64:class Rational < Numeric
rubysl-bigdecimal-2.0.2/lib/bigdecimal/util.rb:1:class Integer < Numeric
rubysl-bigdecimal-2.0.2/lib/bigdecimal/util.rb:18:class Float < Numeric
rubysl-bigdecimal-2.0.2/lib/bigdecimal/util.rb:52:class BigDecimal < Numeric
rubysl-bigdecimal-2.0.2/lib/bigdecimal/util.rb:84:class Rational < Numeric
rubysl-date-2.0.8/lib/rubysl/date/date.rb:255: class Infinity < Numeric # :nodoc:
rubysl-matrix-2.1.0/lib/rubysl/matrix/matrix.rb:1425: class Scalar < Numeric # :nodoc:
rubysl-rational-2.0.1/lib/rubysl/rational/rational.rb:3:class Rational < Numeric
scimath-1.2.0/lib/scimath/numeric.rb:14:class Rational < Numeric
scimath-1.2.0/lib/scimath/numeric.rb:18:class Integer < Numeric
scout_realtime-1.0.5/lib/vendor/backports-3.3.5/lib/backports/1.9.2/stdlib/matrix.rb:1426: class Scalar < Numeric # :nodoc:
shoesgem-0.1514.0/shoes/ruby/lib/bigdecimal/util.rb:18:class Float < Numeric
shoesgem-0.1514.0/shoes/ruby/lib/bigdecimal/util.rb:30:class BigDecimal < Numeric
shoesgem-0.1514.0/shoes/ruby/lib/bigdecimal/util.rb:44:class Rational < Numeric
shoesgem-0.1514.0/shoes/ruby/lib/date.rb:255: class Infinity < Numeric # :nodoc:
shoesgem-0.1514.0/shoes/ruby/lib/matrix.rb:961: class Scalar < Numeric # :nodoc:
simple_units-0.0.0/lib/simple_units/unit.rb:2: class Unit < Numeric
smml-0.1.13/lib/smml/msm.rb:154:class MyLength < Numeric
stick-1.3.3/lib/stick/matrix/core.rb:983: class Scalar < Numeric # :nodoc:
stick-1.3.3/lib/stick/quaternion.rb:230:class Quaternion < Numeric
stick-1.3.3/lib/stick/units/base.rb:363: class Value < Numeric
syck-1.0.4/test/test_yaml.rb:1352: class NumericTest < Numeric
to_bn-2.0.1/lib/to_bn.rb:76:class Integer < Numeric
to_bn-2.0.1/lib/to_bn.rb:115:class Float < Numeric
trafaret-1.5.9/lib/trafaret/numeric.rb:30: class Integer < Numeric
trafaret-1.5.9/lib/trafaret/numeric.rb:40: class Float < Numeric
uncertain-0.1.0/lib/uncertain.rb:12:class Uncertain < Numeric
unit-0.4.1/lib/unit/class.rb:2:class Unit < Numeric
unit-0.4.1/lib/unit/dsl.rb:11:class Unit < Numeric
unit-0.4.1/lib/unit/system.rb:4:class Unit < Numeric
unit-0.4.1/lib/unit/version.rb:1:class Unit < Numeric
vanunits-1.5.0/lib/van/units/base.rb:363: class Value < Numeric
veritas-0.0.7/lib/veritas/attribute/decimal.rb:7: class Decimal < Numeric
veritas-0.0.7/lib/veritas/attribute/float.rb:7: class Float < Numeric
veritas-0.0.7/lib/veritas/attribute/integer.rb:7: class Integer < Numeric
veritas-0.0.7/lib/veritas/function/numeric/absolute.rb:8: class Absolute < Numeric
veritas-0.0.7/lib/veritas/function/numeric/addition.rb:8: class Addition < Numeric
veritas-0.0.7/lib/veritas/function/numeric/division.rb:8: class Division < Numeric
veritas-0.0.7/lib/veritas/function/numeric/exponentiation.rb:8: class Exponentiation < Numeric
veritas-0.0.7/lib/veritas/function/numeric/modulo.rb:8: class Modulo < Numeric
veritas-0.0.7/lib/veritas/function/numeric/multiplication.rb:8: class Multiplication < Numeric
veritas-0.0.7/lib/veritas/function/numeric/square_root.rb:8: class SquareRoot < Numeric
veritas-0.0.7/lib/veritas/function/numeric/subtraction.rb:8: class Subtraction < Numeric
veritas-0.0.7/lib/veritas/function/numeric/unary_minus.rb:8: class UnaryMinus < Numeric
veritas-0.0.7/lib/veritas/function/numeric/unary_plus.rb:8: class UnaryPlus < Numeric
vlaah-0.9.1/lib/vlaah/unit.rb:3: class Unit < Numeric
when_exe-0.3.9/lib/when_exe/coordinates.rb:772: class Pair < Numeric
workbook-0.4.7/lib/workbook/types/Numeric.rb:5: class Numeric < Numeric
Updated by hsbt (Hiroshi SHIBATA) over 8 years ago
- Status changed from Open to Feedback
- Assignee set to usa (Usaku NAKAMURA)
Updated by usa (Usaku NAKAMURA) over 8 years ago
使ってる人がいるならしゃーないですね、と思ってそのままでした。
値の定義がないNumericオブジェクトの存在意義はわからないですし、Numericの子クラスでnewできることの意味もわからないですし、意味があるなら自分でnew定義して正しく意味を付与せよとも思いますが、使ってる人にとっては何らかの意味はあるのでしょうね、多分。
Updated by usa (Usaku NAKAMURA) over 8 years ago
- Status changed from Feedback to Rejected
Actions
Like0
Like0Like0Like0Like0Like0Like0