別のキーワード
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) -
NEWS for Ruby 2
. 4 . 0 (9) -
NEWS for Ruby 2
. 7 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (5) -
NEWS for Ruby 3
. 1 . 0 (4) - Rubyの起動 (6)
-
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 3 feature (12) -
ruby 1
. 8 . 4 feature (12) -
ruby 1
. 9 feature (12) - クラス/メソッドの定義 (12)
- パターンマッチ (9)
- 制御構造 (12)
- 演算子式 (1)
検索結果
-
ruby 1
. 6 feature (133.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...が、この変更は元に戻りました。
p "#{ "" }"
=> ruby 1.6.7 (2002-03-01) [i586-linux]
""
=> -:1: warning: bad substitution in string
ruby 1.6.7 (2002-09-12) [i586-linux]
"#{ }"
=> ruby 1.6.7 (2002-09-25) [i586-linux]......gexp.quote("#")
p /a#{Regexp.quote("#")}b/x =~ "ab"
=> -:3: warning: ambiguous first argument; make sure
ruby 1.6.7 (2002-03-01) [i586-linux]
"#"
0
=> -:3: warning: ambiguous first argument; make sure
ruby 1.6.7 (2002-07-30) [i58......xp.quote("\t")
p /a#{Regexp.quote("\t")}b/x =~ "ab"
=> -:3: warning: ambiguous first argument; make sure
ruby 1.6.7 (2002-03-01) [i586-linux]
"\t"
0
=> -:3: warning: ambiguous first argument; make sure
ruby 1.6.7 (2002-05-04) [i5... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (73.0) -
1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))
...。
# # derived from sample/test.rb
# a = *[]; p a # special case
# def f; yield; end; f {|a| p a} # add (warning)
# def r; return; end; a = r(); p a
# a = nil; p a
# def f; yield nil; end; f {|a| p a}
# def r; return nil; end; a = r(); p a
#......d *1; end; f {|a| p a}
# def r; return *1; end; a = r(); p a
# a = *[]; p a
# def f; yield *[]; end; f {|a| p a} # add (warning)
# def r; return *[]; end; a = r(); p a
# a = *[1]; p a
# def f; yield *[1]; end; f {|a| p a}
# def r; return *[1]; end; a = r(); p a......add
# def r; return *[1,2]; end; a = r(); p a # add
# a = *[*[]]; p a
# def f; yield *[*[]]; end; f {|a| p a} # add(warning)
# def r; return *[*[]]; end; a = r(); p a
# a = *[*[1]]; p a
# def f; yield *[*[1]]; end; f {|a| p a}
# def r; return *[*[1]]; end; a... -
NEWS for Ruby 2
. 7 . 0 (73.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...oo(**h) # {} and warning
h = {}; def foo(*a) a end; foo(h) # [{}]
h = {}; def foo(a) a end; foo(h) # {}
//}
* 非推奨に関する警告を止めたい場合は、コマンドライン引数に
「-W:no-deprecated」を指定するか、コードの中で
「Warning[:deprecated] =......ーカル変数名として使えて、ローカル変数が優先されますが、
警告が表示されます。
_1 = 0 #=> warning: `_1' is reserved for numbered parameter; consider another name
[1].each { p _1 } # prints 0 instead of 1
==== ブロックなしの proc/lambda......puts "Hello" } #=> warning: Capturing the given block using Kernel#proc is deprecated; use `&block` instead
//}
* 非推奨に関する警告を止めたい場合は、コマンドライン引数に
「-W:no-deprecated」を指定するか、コードの中で
「Warning[:deprecated] = fa... -
NEWS for Ruby 3
. 0 . 0 (43.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ださい。
== 言語仕様の変更
* Keyword arguments are now separated from positional arguments.
Code that resulted in deprecation warnings in Ruby 2.7 will now
result in ArgumentError or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longe......r = proc{|*a, **kw| [a, kw]}
pr.call([1])
# 2.7 => [[1], {}]
# 3.0 => [[[1]], {}]
pr.call([1, {a: 1}])
# 2.7 => [[1], {:a=>1}] # and deprecation warning
# 3.0 => a=>1}, {}]
//}
* Arguments forwarding (`...`) now supports leading arguments.
16378
//emlist{
def method_missing(meth, ...)
se......ally bundled. It is a
type analysis tool for Ruby programs.
* Deprecation warnings are no longer shown by default (since Ruby 2.7.2).
Turn them on with `-W:deprecated` (or with `-w` to show other warnings too).
16345
* `$SAFE` and `$KCODE` are now normal global variables with no... -
パターンマッチ (31.0)
-
パターンマッチ * patterns * variable_binding * variable_pinning * matching_non_primitive_objects * guard_clauses * current_feature_status * pattern_syntax * some_undefined_behavior_examples
...//emlist[][ruby]{
{a: 1, b: 2} in {a:}
# warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
//}
この警告を抑制したければ、Warning::[]= メソッドが利用できます。
//emlist{
Warning[:experimental] = false
eval('{a: 1, b: 2} in......パターンマッチの警告はコンパイル時に発生するため、以下のような場合は警告は抑制できません。
//emlist{
Warning[:experimental] = false # この行を評価する段階では、構文解析とそれによる警告の発生は、既に終了している
{a: 1......ist{
[0] => [*, 0, *]
# warning: Find pattern is experimental, and the behavior may change in future versions of Ruby!
# warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!
}
この警告を抑制したければ、Warning::[]= メソッドが......きます。
//emlist{
Warning[:experimental] = false
eval('[0] => [*, 0, *]')
# ...警告は出力されない...
//}
パターンマッチの警告はコンパイル時に発生するため、以下のような場合は警告は抑制できません。
//emlist{
Warning[:experimental] = false #......st{
[0] => [*, 0, *]
# warning: Find pattern is experimental, and the behavior may change in future versions of Ruby!
# warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!
//}
この警告を抑制したければ、Warning::[]= メソッドが... -
NEWS for Ruby 2
. 4 . 0 (19.0) -
NEWS for Ruby 2.4.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...t_on_exception を追加 6647
* TracePoint
* TracePoint#callee_id を追加 12747
* Warning
* Warningという名前のモジュールを導入しました。
デフォルトでは Warning.#warn という特異メソッドだけ定義されているモジュールです。... -
ruby 1
. 8 . 4 feature (13.0) -
ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。
...-:2: syntax error, unexpected tSTRING_CONTENT
alias :"foo" :"bar"
^
-:2: warning: unused literal ignored
# => ruby 1.9.0 (2005-12-10) [i686-linux]
"bar"
2) Symbol#inspect sometimes return......object (0xb7e06970) (NotImplementedError)
from -:7
# => ruby 1.8.4 (2005-12-22) [i686-linux]
-:3:in `foo'-:3: warning: too many arguments for format string
: super: no superclass method `foo' (NoMethodError)
from -:7
: 正規表現 [......サンプル兼ライブラリ
#Wed Dec 7 01:02:04 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
#
# * ext/tk/README.macosx-aqua: [new document] tips to avoid the known
# bug on platform specific dialogs of Tcl/Tk Aqua on MacOS X.
MacOS X 上で Aqua 版の Tcl/Tk を用いた... -
制御構造 (13.0)
-
制御構造 条件分岐: * if * unless * case 繰り返し: * while * until * for * break * next * redo * retry 例外処理: * raise * begin その他: * return * BEGIN * END
...により例外を処理することが
できます。
==== rescue修飾子
//emlist[例][ruby]{
open("nonexistent file") rescue STDERR.puts "Warning: #$!"
//}
文法:
式1 rescue 式2
式1で例外が発生したとき、式2を評価します。
以下と同じ意味です。捕捉......行いたい場合は Kernel.#at_exit を使
います。
def foo
END { p "end" }
end
p foo
# => -:2: warning: END in method; use at_exit
nil
"end"
END は、BEGIN とは異なり実行時に後処理を登録します。した... -
NEWS for Ruby 3
. 1 . 0 (7.0) -
NEWS for Ruby 3.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...パイラは、1000命令列長より長いメソッドのコンパイルをスキップしなくなりました。
* --mjit-verbose や --mjit-warning は、TracePoint または GC.compact が使用されており、JITコンパイルされたコードが無効になった時に "JIT cancel" と... -
Rubyの起動 (7.0)
-
Rubyの起動 * cmd_option * shebang
...フォルト)
* -W:no-experimental : 実験的な機能を使用した際に警告を出力しない
//}
ここで設定された値は Warning.[] で参照することができます。
NOTE: Ruby 2.7.2 からは `-W:no-deprecated' がデフォルトになります。警告を出力......: --jit
デフォルトの設定でJITを有効にします。
: --jit-[option]
指定した設定でJITを有効にします。
: --jit-warnings
JITの警告の出力を有効にします。
: --jit-debug
JITのデバッグを有効にします。(非常に遅くなります。)
:......-mjit
デフォルトの設定でMJITを有効にします。
: --mjit-[option]
指定した設定でMJITを有効にします。
: --mjit-warnings
JITの警告の出力を有効にします。
: --mjit-debug
JITのデバッグを有効にします。(非常に遅くなります。)... -
ruby 1
. 8 . 3 feature (7.0) -
ruby 1.8.3 feature *((<ruby 1.8 feature>)) *((<ruby 1.8.2 feature>))
...io = IO.open(0)
io.nonblock = true
p io.read(4)'
-e:4: warning: nonblocking IO#read is obsolete; use IO#readpartial or IO#sysread
-e:4:in `read': Resource temporarily unavailable (Errno::EAGAIN)... -
ruby 1
. 9 feature (7.0) -
ruby 1.9 feature ruby version 1.9.0 は開発版です。 以下にあげる機能は将来削除されたり互換性のない仕様変更がなされるかもしれません。 1.9.1 以降は安定版です。 バグ修正がメインになります。
...警告はデバッグモード・冗長モードでしかでなくなりました。
% ruby -e 'p ("")'
""
% ruby -de 'p ("")'
-e:1: warning: (...) interpreted as grouped expression
""
=== 2005-03-02
: proc [ruby][experimental]
{|a| ...} や (do ... end) が proc として解釈...