summaryrefslogtreecommitdiff
path: root/doc/NEWS
blob: 659656d376007e21a01403ef0c20db395a6a79cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
: Range#step([step=1])

  Added.

: Regexp

  It is being obsoleted to regard /re/ as /re/ =~ $_ in a conditional
  context.  Use ~/re/ instead.

: String#lstrip, rstrip, lstrip!, rstrip!

  Added.  These strip only left or right part of a string.

: Socket::pack_sockaddr_in(), Socket::unpack_sockaddr_in()

  Added.  Utility for direct Socket access.

: Socket::pack_sockaddr_un(), Socket::unpack_sockaddr_un()

  Added.  Utility for direct Socket access.

: String#casecmp

  Added.  This is a case insensitive version of String#<=>.

: String#eql?

  Changed to be always case sensitive.

: Module#include?

  Added. [ruby-dev:13941] 

: Digest module

  Added as a replacement for md5 and sha1 modules.

    require 'digest/md5'
    include Digest

    md = MD5.new
    md << "abc"
    puts md

    puts MD5.hexdigest("123")

: Dir::chdir

  Changed to warn only when invoked from multiple threads or no block
  is given. [ruby-dev:13823]

    Dir.chdir("/tmp")

    pwd = Dir.pwd	#=> "/tmp"
    puts pwd

    Dir.chdir("foo") {
      pwd = Dir.pwd	#=> "/tmp/foo"
      puts pwd

      Dir.chdir("bar") {	# <-- previously warned
        pwd = Dir.pwd	#=> "/tmp/foo/bar"
        puts pwd
      }

      pwd = Dir.pwd	#=> "/tmp/foo"
      puts pwd
    }

    pwd = Dir.pwd	#=> "/tmp"
    puts pwd

: Proc#yield

  Added.  This is equivalent to Proc#call except it does not check the
  number of given arguments, which are thus passed to the proc as-is.

: File#fnmatch, File::Constants::FNM_*

  Added.  Refer to the fnmatch(3) manpage for details.

  e.g.

    # exclude files matching "*.bak".
    files.reject! { |fn| File::fnmatch?("*.bak", fn) }

: Method#==

  Added.

: Multiple assignment behavior

  Fixed so that "*a = nil" results in "a == []".

: Array expansion

  Fixed with the following behavior:

    a = *[1]
    p a #=> [1]

  Now 1-element array in rhs is expanded properly.

    a = *[1]
    p a #=> 1

: NameError & NoMethodError

  Moved and now NoMethodError < NameError < StandardError.

: open

  Extended so that when the third argument is permission flags it
  calls open(2) instead of fopen(3).

: Marshal

  Fixed not to dump anonymous classes/modules.

  Fixed with loading modules.

: constants

  Improved at the performance of searching by using an internal hash
  table.

: Syntax

  Experimentally altered to get the following code (note the space
  after p):

    p ("xx"*2).to_i

  Interpreted as:

    p (("xx"*2).to_i)

  Instead of:

    (p("xx"*2)).to_i

: Range#to_ary

  Added.  You can now do something like this:

    a, b, c = 1..3

: break and next

  Extended to take an optional expression, which is used as a value
  for termination. [experimental]

: SHA1 module

  ruby-sha1 1.2 is newly imported as a standard library, which shares
  a common interface with the existing md5 module.

: MD5#<<

  Added as an alias for MD5#update.

: to_str

  Added to get objects which define to_str() treated as String's.

  Now almost all the built-in methods try each argument with to_str()
  when they expect it to be a String.

    foo = Object.new
    class <<foo
      def to_str
        "foo"
      end
    end
    p File.open(foo)
    => -:7:in `open': wrong argument type Object (expected String) (TypeError)
       ruby 1.6.4 (2001-04-19) [i586-linux]
    => -:7:in `open': No such file or directory - "foo" (Errno::ENOENT)
       ruby 1.7.0 (2001-05-02) [i586-linux]

: Line-range operation

  Obsoleted except the case when used in a one-liner (ruby -e "..."),
  which means "if 101..200" in a script is no longer interpreted as
  comparison between (({$.})) and 101 or 200.

: Comparison of exception classes in a rescue clause

  Changed to use ((<Module>))#=== for comparing $! with the exception
  class specified in each rescue clause.

  As the previous behavior was to use kind_of?, the effect is limited
  to the SystemCallError case.  SystemCallError.=== has been newly
  defined to return true when the two have the same errno.  With this
  change, SystemCallError's with the same errno, such as Errno::EAGAIN
  and Errno::EWOULDBLOCK, can both be rescued by listing just one of
  them.

: ((<Array>))#fetch

  Added.

: ((<Array>))#insert(n, other, ...)

  Added. ((<ruby-talk:14289>))

  This is much the same as (({ary[n,0] = [other,...]})) except
  returing self.

        ary = [0,1,2,3]
        ary[2, 0] = [4, 5, 6]
        p ary

        ary = [0,1,2,3]
        ary.insert(2, 4, 5, 6)
        p ary

: ((<Array>))#sort!

  Changed to always return self without checking whether the sequence
  of the elements was modified or not.

  Beware that this behavior is not guaranteed to continue in the
  future.  Do not rely on its return value. ((<ruby-dev:12506>)).

: ((<Dir>)).open

  Changed to return what the block returns when a block is given, just
  as ((<File>)).open does. (It always returned (({nil})) in 1.6 and
  prior)

: ((<Dir>)).chdir

  Extended to take a block.

: ((<Dir>)).glob

  Made to support meta-character escaping by a backslash.  Wildcards
  and spaces may now be escaped using a backslash.

: ((<Enumerable>))#all?
: ((<Enumerable>))#any?
: ((<Enumerable>))#inject

  Added.

: ((<File>)).lchmod
: ((<File>)).lchown

  Added.

: ((<IO>)).for_fd

  Added.

: ((<IO>)).read

  Added. ((<ruby-talk:9460>))

: ((<Interrupt>))

  Made a subclass of ((<SignalException>)). (It was a subclass of
  Exception in 1.6 and prior)

: ((<MatchData>))#to_ary

  Added for convenience of Regexp#match. ((<ruby-dev:12766>))

  Previously we had to do:

    foo, bar, baz = /(\w+?)\s+(\w+?)\s+(\w+)/.match("foo bar baz").to_a[1..-1]
    p [foo, bar, baz]

  But now can do:

    _, foo, bar, baz = /(\w+?)\s+(\w+?)\s+(\w+)/.match("foo bar baz")
    p [foo, bar, baz]

: ((<Math>)).acos(x)
: ((<Math>)).asin(x)
: ((<Math>)).atan(x)
: ((<Math>)).cosh(x)
: ((<Math>)).sinh(x)
: ((<Math>)).tanh(x)
: ((<Math>)).hypot(x,y)

  Added.

: ((<Module>))#included

  Added.  This is a hook called after Module#append_feature.

: ((<Module>))#method_removed
: ((<Module>))#method_undefined

  Added.

: ((<NoMethodError>))

  Added. ((<ruby-dev:12763>))

: NotImplementError

  Finally obsoleted.  Use ((<NotImplementedError>)).

: ((<Object>))#singleton_method_removed
: ((<Object>))#singleton_method_undefined

  Added.

: ((<Proc>))#==

  Added.

: ((<Process>)).times

  Moved from ((<Time>)).times. (Time.times still remains but emits a
  warning)

: ((<Process::Status>))

  Added.  (({$?})) is now an instance of this class.

: ((<Process>)).waitall

  Added.

: ((<Regexp>)).last_match(n)

  Extended to take an optional argument.

: ((<Regexp>))#options

  Added.

: ((<String>))#insert(n, other)

  Added.

  This is much the same as (({str[n, 0] = other})) except returing
  self.

: ((<Symbol>)).all_symbols

  Added. ((<ruby-dev:12921>))

: ((<Symbol>))#intern

  Added.

: ((<SystemCallError>)).===

  Added. (See the "Comparison of exception classes in a rescue clause"
  paragraph above) ((<ruby-dev:12670>))

: ((<SystemExit>))#status

  Added.

: ((<TCPSocket>)).new
: ((<TCPSocket>)).open

  Extended to take an address and a port number for the local side in
  optional 3rd and 4th arguments.

: ((<Time>))

  Extended to accept a negative time_t. (Only when the platform
  supports it)

    p Time.at(-1)
    => Thu Jan 01 08:59:59 JST 1970

: ((<Time>))#to_a
: ((<Time>))#zone

  Made to return "UTC" under gmtime.  It used to return a platform
  dependent value, typically "GMT", in 1.6 and prior.

To be investigated:

 Sat Feb 24 03:15:49 2001  Yukihiro Matsumoto  <matz@ruby-lang.org>

        * io.c (set_stdin): preserve original stdin.

        * io.c (set_outfile): preserve original stdout/stderr.