Issue #1269 has been updated by Motohiro KOSAKI.

Status changed from Assigned to Rejected

??????????????????????????????????????????????????人??reopen?????????????????????人?????? ?????警???????????????? ??? ?????????????????????????? ?????????????????????????????????????議????????????????????????????????????????????????????????????
----------------------------------------
Feature #1269: warning when Kernel#p is used
https://bugs.ruby-lang.org/issues/1269

Author: Yusuke Endoh
Status: Rejected
Priority: Low
Assignee: Yukihiro Matsumoto
Category: core
Target version: 2.0.0


=begin
 ???????????
 
 Kernel#p ????常?便??????????????????????????? p ???????????????????????????
 ???????????????????????????
 p ???????????????使???????????常?便????????????念???????索??????????常??
 ?便?????????????????????索????????????????????索?????????????????????
 ???????????????索????????????????????????
 
   - p ???????????? attr ???使???????????
   - rdoc 中?????????????????? p ???使???????????
   - html ??????? <p> ??? sprint ??? %p ???????????????????中???????????
 
 ?????false positive ???????????????????
 p ???????義??????????止???????? p ?????????????????害????????????????
 ???????????????????????????????????????????????????????????????????????
 ???????????????????????????????
 
 
 ??????????$DEBUG = true ???????? p ??????????????????????????????????????
 警?????????????????????????????
 
 # ???常????????????????
 $ ruby19 -e 'p :debug'
 :debug
 
 # -d ????????????警?????????
 $ ruby19 -d -e 'p :debug'
 -e:1: warning: Kernel#p is used
 :debug
 
 # ?????????????????????????????????????????????????????
 $ ruby19 -d -e 'p :debug if rand > 0.999'
 -e:1: warning: Kernel#p is used
 
 # ??????????????????警??????????
 $ ruby19 -d -e 's = Struct.new(:p); p = s.new; p.p = "<p>"; puts p.p'
 <p>
 
 ?????????????eval ????????????????中?? p ????????????????????????????????
 ???????????????????????????????????????????????????????????????????
 
 
 ???????
 
   - p ????????????????????????????????????警?????????????????????????
   - ???????
 
 ????????????????????????????$DEBUG = true ???????????????????????人??????
 許容???????????????????????????????????????????
 
 
 Index: id.c
 ===================================================================
 --- id.c	(revision 22892)
 +++ id.c	(working copy)
 @@ -47,4 +47,5 @@
      REGISTER_SYMID(idSend, "send");
      REGISTER_SYMID(id__send__, "__send__");
      REGISTER_SYMID(idInitialize, "initialize");
 +    REGISTER_SYMID(idP, "p");
  }
 Index: parse.y
 ===================================================================
 --- parse.y	(revision 22892)
 +++ parse.y	(working copy)
 @@ -1257,6 +1257,9 @@
  command		: operation command_args       %prec tLOWEST
  		    {
  		    /*%%%*/
 +			if ($1 == idP && RTEST(ruby_debug)) {
 +			    rb_warning0("Kernel#p is used");
 +			}
  			$$ = NEW_FCALL($1, $2);
  			fixpos($$, $2);
  		    /*%
 @@ -3525,6 +3528,9 @@
  method_call	: operation paren_args
  		    {
  		    /*%%%*/
 +			if ($1 == idP && RTEST(ruby_debug)) {
 +			    rb_warning0("Kernel#p is used");
 +			}
  			$$ = NEW_FCALL($1, $2);
  			fixpos($$, $2);
  		    /*%
 Index: id.h
 ===================================================================
 --- id.h	(revision 22892)
 +++ id.h	(working copy)
 @@ -99,6 +99,7 @@
      tSend,
      t__send__,
      tInitialize,
 +    tP,
  #if SUPPORT_JOKE
      tBitblt,
      tAnswer,
 @@ -118,7 +119,8 @@
      TOKEN2ID(Lambda),
      TOKEN2ID(Send),
      TOKEN2ID(__send__),
 -    TOKEN2ID(Initialize)
 +    TOKEN2ID(Initialize),
 +    TOKEN2ID(P)
  };
 
  #ifdef tLAST_TOKEN
 Index: template/id.h.tmpl
 ===================================================================
 --- template/id.h.tmpl	(revision 22892)
 +++ template/id.h.tmpl	(working copy)
 @@ -92,6 +92,7 @@
      tSend,
      t__send__,
      tInitialize,
 +    tP,
  #if SUPPORT_JOKE
      tBitblt,
      tAnswer,
 @@ -111,7 +112,8 @@
      TOKEN2ID(Lambda),
      TOKEN2ID(Send),
      TOKEN2ID(__send__),
 -    TOKEN2ID(Initialize)
 +    TOKEN2ID(Initialize),
 +    TOKEN2ID(P)
  };
 
  #ifdef tLAST_TOKEN
 
 -- 
 Yusuke ENDOH <mame / tsg.ne.jp>
=end



-- 
http://bugs.ruby-lang.org/