Ruby Issue Tracking System: Issueshttps://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112020-09-15T09:11:09ZRuby Issue Tracking System
Redmine Ruby master - Feature #17168 (Closed): Bundle RBShttps://redmine.ruby-lang.org/issues/171682020-09-15T09:11:09Zsoutaro (Soutaro Matsumoto)matsumoto@soutaro.com
<p><a class="user active user-mention" href="https://redmine.ruby-lang.org/users/572">@hsbt (Hiroshi SHIBATA)</a> and I have been working to make RBS one of the bundled gems.<br>
We are finalizing the patch and hope we can finish it tonight.</p>
<p><a href="https://github.com/ruby/ruby/pull/3496" class="external">https://github.com/ruby/ruby/pull/3496</a></p>
<p>I'd like to ask Matz to approve bundling it in Ruby 3.0 (hopefully before preview 1).</p>
<hr>
<p>RBS is a Ruby gem to support static analyzers in Ruby 3. It consists of the standard library type signatures (.RBS files) and Ruby code to parse and process .RBS files. The repository for RBS is <a href="https://github.com/ruby/rbs" class="external">https://github.com/ruby/rbs</a>.</p> Ruby master - Bug #17094 (Closed): PTY methods with blockshttps://redmine.ruby-lang.org/issues/170942020-07-31T05:44:08Zsoutaro (Soutaro Matsumoto)matsumoto@soutaro.com
<p>Some methods on PTY yield one array if a block is given, but the RDoc says it passes two arguments to the block.</p>
<p><a href="https://github.com/ruby/ruby/blob/master/ext/pty/pty.c#L529" class="external">https://github.com/ruby/ruby/blob/master/ext/pty/pty.c#L529</a></p>
<pre><code class="c syntaxhl" data-language="c"><span class="k">return</span> <span class="nf">rb_ensure</span><span class="p">(</span><span class="n">rb_yield</span><span class="p">,</span> <span class="n">assoc</span><span class="p">,</span> <span class="n">pty_close_pty</span><span class="p">,</span> <span class="n">assoc</span><span class="p">);</span>
</code></pre>
<p><a href="https://github.com/ruby/ruby/blob/master/ext/pty/pty.c#L467" class="external">https://github.com/ruby/ruby/blob/master/ext/pty/pty.c#L467</a></p>
<pre><code> * PTY.open {|master_io, slave_file| ... } => block value
</code></pre>
<p>I'd like to propose to fix the implementation. However, it would make more sense to fix the docs because of potential incompatibilities.</p> Ruby master - Feature #12490 (Closed): Remove warning on shadowing block paramshttps://redmine.ruby-lang.org/issues/124902016-06-15T02:44:13Zsoutaro (Soutaro Matsumoto)matsumoto@soutaro.com
<p>Running ruby with -w option reports warnings on shadowing block params.</p>
<pre><code>$ cat -n w.rb
1 a = [1]
2
3 a.each do |a|
4 a = 3
5 end
6
7 p a
$ ruby -cw w.rb
w.rb:3: warning: shadowing outer local variable - a
Syntax OK
</code></pre>
<p>I would like to propose to remove the warning.</p>
<p>It was introduced to ruby 1.9, a version which changes behaviors on conflicts of local vars and block param. I understand it is to tell the user the change, and let them fix if their program depends on 1.8 behavior. ruby 1.9.1 is released in 2009, almost seven years ago, and most ruby programmers today would have correct understanding of current behavior. In my opinion, the warning does not make sense now but just annoying.</p>
<ul>
<li>I like giving block params shadowing name to avoid finding new good names</li>
<li>Lint tools including RuboCop can report the warning instead of ruby</li>
</ul> Ruby master - Feature #11297 (Closed): Allow private method of self to be calledhttps://redmine.ruby-lang.org/issues/112972015-06-23T13:27:48Zsoutaro (Soutaro Matsumoto)matsumoto@soutaro.com
<p>Ruby does not allow private method to be called if receiver is given. Calling private method with receiver is prohibited even if it is written as self, though the fact that the receiver is self is still clear.</p>
<p>This ticket is to propose to allow the private method to be called if its receiver is written as self.</p>
<p>The following Ruby program is to explain my idea.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="k">class</span> <span class="nc">A</span>
<span class="kp">private</span> <span class="k">def</span> <span class="nf">f</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="no">A</span><span class="p">.</span><span class="nf">new</span><span class="p">.</span><span class="nf">instance_eval</span> <span class="k">do</span>
<span class="n">f</span><span class="p">()</span> <span class="c1"># Okay, without receiver</span>
<span class="nb">self</span><span class="p">.</span><span class="nf">f</span> <span class="c1"># Currently NoMethodError, but should be okay in my opinion</span>
<span class="nb">self</span><span class="p">.</span><span class="nf">itself</span><span class="p">.</span><span class="nf">f</span> <span class="c1"># NoMethodError anyway; the receiver is not written as self</span>
<span class="k">end</span>
</code></pre>
<p>This change will allow to call private accessor method like <code>self.title=</code>.<br>
It also will make refactoring to make a public method private easier. Currently, such kind of refactoring may require to rename duplicated local variables or add <code>()</code> to method calls.</p>