先日、新しいマシンに Rails 環境を作ってみたところ、 「colon will be obsoleted; use semicolon」という警告が大量に発生しました。
% ruby script/server /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/inflector.rb:169: warning: colon will be obsoleted; use semicolon /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/inflector.rb:170: warning: colon will be obsoleted; use semicolon /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/inflector.rb:171: warning: colon will be obsoleted; use semicolon /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/json/encoders/core.rb:24: warning: colon will be obsoleted; use semicolon /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/json/encoders/core.rb:25: warning: colon will be obsoleted; use semicolon ...
調べてみると、これはつい最近 Ruby に入った変更が原因のようです。
http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/ruby/parse.y.diff?r1=1.307.2.36;r2=1.307.2.37
--- ruby/parse.y 2006/06/20 16:41:08 1.307.2.36 +++ ruby/parse.y 2006/07/13 15:42:48 1.307.2.37 @@ -2,8 +2,8 @@ parse.y - - $Author: nobu $ - $Date: 2006/06/20 16:41:08 $ + $Author: matz $ + $Date: 2006/07/13 15:42:48 $ created at: Fri May 28 18:02:42 JST 1993 Copyright (C) 1993-2003 Yukihiro Matsumoto @@ -1731,6 +1731,11 @@ primary_value : primary then : term | ':' + { + rb_warn("colon will be obsoleted; use semicolon"); + value_expr($1); + $$ = $1; + } | kTHEN | term kTHEN ;
しかし、ここにコロンが書けたなんて初めて知りました。
% ruby -ve'if false: true end' ruby 1.8.5 (2006-07-14) [i686-linux] -e:1: warning: colon will be obsoleted; use semicolon