[前][次][番号順一覧][スレッド一覧]

ruby-changes:44419

From: nobu <ko1@a...>
Date: Wed, 26 Oct 2016 15:11:31 +0900 (JST)
Subject: [ruby-changes:44419] nobu:r56492 (trunk): [DOC] replace Fixnum with Integer [ci skip]

nobu	2016-10-26 15:11:23 +0900 (Wed, 26 Oct 2016)

  New Revision: 56492

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56492

  Log:
    [DOC] replace Fixnum with Integer [ci skip]
    
    * numeric.c: [DOC] update document for Integer class.

  Modified files:
    trunk/bignum.c
    trunk/error.c
    trunk/ext/bigdecimal/bigdecimal.c
    trunk/ext/objspace/object_tracing.c
    trunk/ext/openssl/ossl_pkey_ec.c
    trunk/ext/socket/basicsocket.c
    trunk/ext/win32ole/win32ole_variant.c
    trunk/ext/zlib/zlib.c
    trunk/hash.c
    trunk/io.c
    trunk/math.c
    trunk/numeric.c
    trunk/object.c
    trunk/proc.c
    trunk/process.c
    trunk/re.c
    trunk/string.c
    trunk/thread_pthread.c
Index: string.c
===================================================================
--- string.c	(revision 56491)
+++ string.c	(revision 56492)
@@ -4423,10 +4423,10 @@ rb_str_aset(VALUE str, VALUE indx, VALUE https://github.com/ruby/ruby/blob/trunk/string.c#L4423
  *  the text it is replacing, the string will be adjusted accordingly. If the
  *  regular expression or string is used as the index doesn't match a position
  *  in the string, <code>IndexError</code> is raised. If the regular expression
- *  form is used, the optional second <code>Fixnum</code> allows you to specify
+ *  form is used, the optional second <code>Integer</code> allows you to specify
  *  which portion of the match to replace (effectively using the
- *  <code>MatchData</code> indexing rules. The forms that take a
- *  <code>Fixnum</code> will raise an <code>IndexError</code> if the value is
+ *  <code>MatchData</code> indexing rules. The forms that take an
+ *  <code>Integer</code> will raise an <code>IndexError</code> if the value is
  *  out of range; the <code>Range</code> form will raise a
  *  <code>RangeError</code>, and the <code>Regexp</code> and <code>String</code>
  *  will raise an <code>IndexError</code> on negative match.
@@ -5196,8 +5196,8 @@ str_byte_aref(VALUE str, VALUE indx) https://github.com/ruby/ruby/blob/trunk/string.c#L5196
  *     str.byteslice(integer, integer)   -> new_str or nil
  *     str.byteslice(range)            -> new_str or nil
  *
- *  Byte Reference---If passed a single <code>Fixnum</code>, returns a
- *  substring of one byte at that position. If passed two <code>Fixnum</code>
+ *  Byte Reference---If passed a single <code>Integer</code>, returns a
+ *  substring of one byte at that position. If passed two <code>Integer</code>
  *  objects, returns a substring starting at the offset given by the first, and
  *  a length given by the second. If given a <code>Range</code>, a substring containing
  *  bytes at offsets given by the range is returned. In all three cases, if
@@ -8521,7 +8521,7 @@ rb_str_ord(VALUE s) https://github.com/ruby/ruby/blob/trunk/string.c#L8521
  *     str.sum(n=16)   -> integer
  *
  *  Returns a basic <em>n</em>-bit checksum of the characters in <i>str</i>,
- *  where <em>n</em> is the optional <code>Fixnum</code> parameter, defaulting
+ *  where <em>n</em> is the optional <code>Integer</code> parameter, defaulting
  *  to 16. The result is simply the sum of the binary value of each byte in
  *  <i>str</i> modulo <code>2**n - 1</code>. This is not a particularly good
  *  checksum.
Index: object.c
===================================================================
--- object.c	(revision 56491)
+++ object.c	(revision 56492)
@@ -147,12 +147,12 @@ rb_obj_equal(VALUE obj1, VALUE obj2) https://github.com/ruby/ruby/blob/trunk/object.c#L147
  * call-seq:
  *    obj.hash    -> integer
  *
- * Generates a Fixnum hash value for this object.  This function must have the
+ * Generates an Integer hash value for this object.  This function must have the
  * property that <code>a.eql?(b)</code> implies <code>a.hash == b.hash</code>.
  *
  * The hash value is used along with #eql? by the Hash class to determine if
  * two objects reference the same hash key.  Any hash value that exceeds the
- * capacity of a Fixnum will be truncated before being used.
+ * capacity of an Integer will be truncated before being used.
  *
  * The hash value for an object may not be identical across invocations or
  * implementations of Ruby.  If you need a stable identifier across Ruby
@@ -221,7 +221,7 @@ rb_class_real(VALUE cl) https://github.com/ruby/ruby/blob/trunk/object.c#L221
  *  called with an explicit receiver, as <code>class</code> is also a
  *  reserved word in Ruby.
  *
- *     1.class      #=> Fixnum
+ *     1.class      #=> Integer
  *     self.class   #=> Object
  */
 
@@ -241,7 +241,7 @@ rb_obj_class(VALUE obj) https://github.com/ruby/ruby/blob/trunk/object.c#L241
  *  If <i>obj</i> is <code>nil</code>, <code>true</code>, or
  *  <code>false</code>, it returns NilClass, TrueClass, or FalseClass,
  *  respectively.
- *  If <i>obj</i> is a Fixnum or a Symbol, it raises a TypeError.
+ *  If <i>obj</i> is an Integer, a Float or a Symbol, it raises a TypeError.
  *
  *     Object.new.singleton_class  #=> #<Class:#<Object:0xb7ce1e24>>
  *     String.singleton_class      #=> #<Class:String>
@@ -1087,8 +1087,8 @@ rb_obj_infect(VALUE obj1, VALUE obj2) https://github.com/ruby/ruby/blob/trunk/object.c#L1087
  *     prog.rb:3:in `<<': can't modify frozen Array (RuntimeError)
  *     	from prog.rb:3
  *
- *  Objects of the following classes are always frozen: Fixnum,
- *  Bignum, Float, Symbol.
+ *  Objects of the following classes are always frozen: Integer,
+ *  Float, Symbol.
  */
 
 VALUE
@@ -2734,7 +2734,7 @@ rb_Integer(VALUE val) https://github.com/ruby/ruby/blob/trunk/object.c#L2734
  *  call-seq:
  *     Integer(arg, base=0)    -> integer
  *
- *  Converts <i>arg</i> to a <code>Fixnum</code> or <code>Bignum</code>.
+ *  Converts <i>arg</i> to an <code>Integer</code>.
  *  Numeric types are converted directly (with floating point numbers
  *  being truncated).  <i>base</i> (0, or between 2 and 36) is a base for
  *  integer string representation.  If <i>arg</i> is a <code>String</code>,
Index: hash.c
===================================================================
--- hash.c	(revision 56491)
+++ hash.c	(revision 56492)
@@ -2863,7 +2863,7 @@ rb_hash_any_p(VALUE hash) https://github.com/ruby/ruby/blob/trunk/hash.c#L2863
  *
  *   g = { foo: [10, 11, 12] }
  *   g.dig(:foo, 1)                    #=> 11
- *   g.dig(:foo, 1, 0)                 #=> TypeError: Fixnum does not have #dig method
+ *   g.dig(:foo, 1, 0)                 #=> TypeError: Integer does not have #dig method
  *   g.dig(:foo, :bar)                 #=> TypeError: no implicit conversion of Symbol into Integer
  */
 
Index: error.c
===================================================================
--- error.c	(revision 56491)
+++ error.c	(revision 56492)
@@ -1816,7 +1816,7 @@ syserr_eqq(VALUE self, VALUE exc) https://github.com/ruby/ruby/blob/trunk/error.c#L1816
  *
  *  Since constant names must start with a capital:
  *
- *     Fixnum.const_set :answer, 42
+ *     Integer.const_set :answer, 42
  *
  *  <em>raises the exception:</em>
  *
Index: re.c
===================================================================
--- re.c	(revision 56491)
+++ re.c	(revision 56492)
@@ -3292,7 +3292,7 @@ rb_reg_match_m_p(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/re.c#L3292
  *  String or a Regexp (in which case that regexp's options are propagated),
  *  and new options may not be specified (a change as of Ruby 1.8).
  *
- *  If +options+ is a Fixnum, it should be one or more of the constants
+ *  If +options+ is an Integer, it should be one or more of the constants
  *  Regexp::EXTENDED, Regexp::IGNORECASE, and Regexp::MULTILINE,
  *  <em>or</em>-ed together.  Otherwise, if +options+ is not
  *  +nil+ or +false+, the regexp will be case insensitive.
Index: process.c
===================================================================
--- process.c	(revision 56491)
+++ process.c	(revision 56492)
@@ -501,7 +501,7 @@ rb_last_status_clear(void) https://github.com/ruby/ruby/blob/trunk/process.c#L501
  *     stat.to_i     -> integer
  *     stat.to_int   -> integer
  *
- *  Returns the bits in _stat_ as a <code>Fixnum</code>. Poking
+ *  Returns the bits in _stat_ as a <code>Integer</code>. Poking
  *  around in these bits is platform dependent.
  *
  *     fork { exit 0xab }         #=> 26566
Index: numeric.c
===================================================================
--- numeric.c	(revision 56491)
+++ numeric.c	(revision 56492)
@@ -669,7 +669,7 @@ num_real_p(VALUE num) https://github.com/ruby/ruby/blob/trunk/numeric.c#L669
  *  call-seq:
  *     num.integer?  ->  true or false
  *
- *  Returns +true+ if +num+ is an Integer (including Fixnum and Bignum).
+ *  Returns +true+ if +num+ is an Integer.
  *
  *      (1.0).integer? #=> false
  *      (1).integer?   #=> true
@@ -787,8 +787,8 @@ num_infinite_p(VALUE num) https://github.com/ruby/ruby/blob/trunk/numeric.c#L787
  *  Invokes the child class's +to_i+ method to convert +num+ to an integer.
  *
  *      1.0.class => Float
- *      1.0.to_int.class => Fixnum
- *      1.0.to_i.class => Fixnum
+ *      1.0.to_int.class => Integer
+ *      1.0.to_i.class => Integer
  */
 
 static VALUE
@@ -2952,11 +2952,13 @@ rb_num2ull(VALUE val) https://github.com/ruby/ruby/blob/trunk/numeric.c#L2952
 
 #endif  /* HAVE_LONG_LONG */
 
-/*
+/********************************************************************
+ *
  * Document-class: Integer
  *
- *  This class is the basis for the two concrete classes that hold whole
- *  numbers, Bignum and Fixnum.
+ *  Holds Integer values.  You cannot add a singleton method to an
+ *  Integer. Any attempt to add a singleton method to an Integer object
+ *  will raise a TypeError.
  *
  */
 
@@ -3039,8 +3041,6 @@ int_even_p(VALUE num) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3041
 /*
  *  Document-method: Integer#succ
  *  Document-method: Integer#next
- *  Document-method: Fixnum#succ
- *  Document-method: Fixnum#next
  *  call-seq:
  *     int.next  ->  integer
  *     int.succ  ->  integer
@@ -3192,22 +3192,8 @@ int_ord(VALUE num) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3192
     return num;
 }
 
-/********************************************************************
- *
- * Document-class: Fixnum
- *
- *  Holds Integer values that can be represented in a native machine word
- *  (minus 1 bit).  If any operation on a Fixnum exceeds this range, the value
- *  is automatically converted to a Bignum.
- *
- *  Fixnum objects have immediate value. This means that when they are assigned
- *  or passed as parameters, the actual object is passed, rather than a
- *  reference to that object.
- *
- *  Assignment does not alias Fixnum objects. There is effectively only one
- *  Fixnum object instance for any given integer value, so, for example, you
- *  cannot add a singleton method to a Fixnum. Any attempt to add a singleton
- *  method to a Fixnum object will raise a TypeError.
+/*
+ * Fixnum
  */
 
 
@@ -3325,7 +3311,6 @@ rb_int2str(VALUE x, int base) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3311
 
 /*
  * Document-method: Integer#+
- * Document-method: Fixnum#+
  * call-seq:
  *   int + numeric  ->  numeric_result
  *
@@ -3381,7 +3366,6 @@ rb_int_plus(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3366
 
 /*
  * Document-method: Integer#-
- * Document-method: Fixnum#-
  * call-seq:
  *   int - numeric  ->  numeric_result
  *
@@ -3434,7 +3418,6 @@ rb_int_minus(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3418
 
 /*
  * Document-method: Integer#*
- * Document-method: Fixnum#*
  * call-seq:
  *   int * numeric  ->  numeric_result
  *
@@ -3521,7 +3504,6 @@ int_fdiv(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3504
 
 /*
  * Document-method: Integer#/
- * Document-method: Fixnum#/
  * call-seq:
  *   int / numeric  ->  numeric_result
  *
@@ -3609,7 +3591,6 @@ rb_int_idiv(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3591
 }
 
 /*
- *  Document-method: Fixnum#%
  *  Document-method: Integer#%
  *  Document-method: Integer#modulo
  *  call-seq:
@@ -3741,7 +3722,7 @@ int_divmod(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3722
  *
  *  Raises +integer+ to the power of +numeric+, which may be negative or
  *  fractional.
- *  The result may be a Fixnum, Bignum, or Float
+ *  The result may be an Integer, or a Float
  *
  *    2 ** 3      #=> 8
  *    2 ** -1     #=> (1/2)
@@ -3864,7 +3845,6 @@ rb_int_pow(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3845
 
 /*
  * Document-method: Integer#==
- * Document-method: Fixnum#==
  * call-seq:
  *   int == other  ->  true or false
  *
@@ -3958,7 +3938,6 @@ int_cmp(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3938
 
 /*
  * Document-method: Integer#>
- * Document-method: Fixnum#>
  * call-seq:
  *   int > real  ->  true or false
  *
@@ -3997,7 +3976,6 @@ int_gt(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3976
 
 /*
  * Document-method: Integer#>=
- * Document-method: Fixnum#>=
  * call-seq:
  *   int >= real  ->  true or false
  *
@@ -4038,7 +4016,6 @@ rb_int_ge(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L4016
 
 /*
  * Document-method: Integer#<
- * Document-method: Fixnum#<
  * call-seq:
  *   int < real  ->  true or false
  *
@@ -4077,7 +4054,6 @@ int_lt(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L4054
 
 /*
  * Document-method: Integer#<=
- * Document-method: Fixnum#<=
  * call-seq:
  *   int <= real  ->  true or false
  *
@@ -5019,7 +4995,7 @@ int_truncate(int argc, VALUE* argv, VALU https://github.com/ruby/ruby/blob/trunk/numeric.c#L4995
  * by preventing instantiation and duplication.
  *
  *   Integer.new(1)   #=> NoMethodError: undefined method `new' for Integer:Class
- *   1.dup            #=> TypeError: can't dup Fixnum
+ *   1.dup            #=> TypeError: can't dup Integer
  *
  * For this reason, Numeric should be used when defining other numeric classes.
  *
Index: io.c
===================================================================
--- io.c	(revision 56491)
+++ io.c	(revision 56492)
@@ -6441,7 +6441,7 @@ rb_io_s_open(int argc, VALUE *argv, VALU https://github.com/ruby/ruby/blob/trunk/io.c#L6441
  *     IO.sysopen(path, [mode, [perm]])  -> integer
  *
  *  Opens the given path, returning the underlying file descriptor as a
- *  <code>Fixnum</code>.
+ *  <code>Integer</code>.
  *
  *     IO.sysopen("testfile")   #=> 3
  */
@@ -11378,7 +11378,7 @@ argf_getc(VALUE argf) https://github.com/ruby/ruby/blob/trunk/io.c#L11378
 
 /*
  *  call-seq:
- *     ARGF.getbyte  -> Fixnum or nil
+ *     ARGF.getbyte  -> Integer or nil
  *
  *  Gets the next 8-bit byte (0..255) from +ARGF+. Returns +nil+ if called at
  *  the end of the stream.
@@ -11458,9 +11458,9 @@ argf_readchar(VALUE argf) https://github.com/ruby/ruby/blob/trunk/io.c#L11458
 
 /*
  *  call-seq:
- *     ARGF.readbyte  -> Fixnum
+ *     ARGF.readbyte  -> Integer
  *
- *  Reads the next 8-bit byte from ARGF and returns it as a +Fixnum+. Raises
+ *  Reads the next 8-bit byte from ARGF and returns it as an +Integer+. Raises
  *  an +EOFError+ after the last byte of the last file has been read.
  *
  *  For example:
@@ -11521,7 +11521,7 @@ argf_block_call(ID mid, int argc, VALUE https://github.com/ruby/ruby/blob/trunk/io.c#L11521
  *  which defaults to your platform's newline character) of each file in
  *  +ARGV+. If a block is supplied, each line in turn will be yielded to the
  *  block, otherwise an enumerator is returned.
- *  The optional _limit_ argument is a +Fixnum+ specifying the maximum
+ *  The optional _limit_ argument is an +Integer+ specifying the maximum
  *  length of each line; longer lines will be split according to this limit.
  *
  *  This method allows you to treat the files supplied on the command line as
@@ -11571,7 +11571,7 @@ argf_lines(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/io.c#L11571
  *     ARGF.each_byte                  -> an_enumerator
  *
  *  Iterates over each byte of each file in +ARGV+.
- *  A byte is returned as a +Fixnum+ in the range 0..255.
+ *  A byte is returned as an +Integer+ in the range 0..255.
  *
  *  This method allows you to treat the files supplied on the command line as
  *  a single file consisting of the concatenation of each named file. After
Index: bignum.c
===================================================================
--- bignum.c	(revision 56491)
+++ bignum.c	(revision 56492)
@@ -5443,8 +5443,8 @@ rb_big_le(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L5443
  *     big == obj  -> true or false
  *
  *  Returns <code>true</code> only if <i>obj</i> has the same value
- *  as <i>big</i>. Contrast this with <code>Bignum#eql?</code>, which
- *  requires <i>obj</i> to be a <code>Bignum</code>.
+ *  as <i>big</i>. Contrast this with <code>Integer#eql?</code>, which
+ *  requires <i>obj</i> to be a <code>Integer</code>.
  *
  *     68719476736 == 68719476736.0   #=> true
  */
Index: math.c
===================================================================
--- math.c	(revision 56491)
+++ math.c	(revision 56492)
@@ -683,7 +683,7 @@ math_cbrt(VALUE obj, VALUE x) https://github.com/ruby/ruby/blob/trunk/math.c#L683
  *     Math.frexp(x)    -> [fraction, exponent]
  *
  *  Returns a two-element array containing the normalized fraction (a Float)
- *  and exponent (a Fixnum) of +x+.
+ *  and exponent (an Integer) of +x+.
  *
  *     fraction, exponent = Math.frexp(1234)   #=> [0.6025390625, 11]
  *     fraction * 2**exponent                  #=> 1234.0
Index: ext/zlib/zlib.c
===================================================================
--- ext/zlib/zlib.c	(revision 56491)
+++ ext/zlib/zlib.c	(revision 56492)
@@ -3218,7 +3218,7 @@ rb_gzfile_set_lineno(VALUE obj, VALUE li https://github.com/ruby/ruby/blob/trunk/ext/zlib/zlib.c#L3218
  * Document-method: Zlib::GzipWriter#mtime=
  *
  * Specify the modification time (+mtime+) in the gzip header.
- * Using a Fixnum or Integer.
+ * Using an Integer.
  *
  * Setting the mtime in the gzip header does not effect the
  * mtime of the file generated. Different utilities that
Index: ext/win32ole/win32ole_variant.c
===================================================================
--- ext/win32ole/win32ole_variant.c	(revision 56491)
+++ ext/win32ole/win32ole_variant.c	(revision 56492)
@@ -602,7 +602,7 @@ folevariant_ary_aset(int argc, VALUE *ar https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_variant.c#L602
  *
  *  Returns Ruby object value from OLE variant.
  *     obj = WIN32OLE_VARIANT.new(1, WIN32OLE::VARIANT::VT_BSTR)
- *     obj.value # => "1" (not Fixnum object, but String object "1")
+ *     obj.value # => "1" (not Integer object, but String object "1")
  *
  */
 static VALUE
Index: ext/socket/basicsocket.c
===================================================================
--- ext/socket/basicsocket.c	(revision 56491)
+++ ext/socket/basicsocket.c	(revision 56492)
@@ -158,10 +158,10 @@ bsock_close_write(VALUE sock) https://github.com/ruby/ruby/blob/trunk/ext/socket/basicsocket.c#L158
  * * +optval+ is the value of the option, it is passed to the underlying
  *   setsockopt() as a pointer to a certain number of bytes. How this is
  *   done depends on the type:
- *   - Fixnum: value is assigned to an int, and a pointer to the int is
+ *   - Integer: value is assigned to an int, and a pointer to the int is
  *     passed, with length of sizeof(int).
  *   - true or false: 1 or 0 (respectively) is assigned to an int, and the
- *     int is passed as for a Fixnum. Note that +false+ must be passed,
+ *     int is passed as for an Integer. Note that +false+ must be passed,
  *     not +nil+.
  *   - String: the string's data and length is passed to the socket.
  * * +socketoption+ is an instance of Socket::Option
Index: ext/bigdecimal/bigdecimal.c
===================================================================
--- ext/bigdecimal/bigdecimal.c	(revision 56491)
+++ ext/bigdecimal/bigdecimal.c	(revision 56492)
@@ -680,7 +680,7 @@ BigDecimal_check_num(Real *p) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L680
 
 static VALUE BigDecimal_split(VALUE self);
 
-/* Returns the value as an integer (Fixnum or Bignum).
+/* Returns the value as an Integer.
  *
  * If the BigNumber is infinity or NaN, raises FloatDomainError.
  */
@@ -2483,7 +2483,7 @@ static Real *BigDecimal_new(int argc, VA https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2483
  *           If it is a String, spaces are ignored and unrecognized cha (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]