ruby-lang
March 9th, 2006, 05:45 AM
<p>If I could clean up the little quacks that Ruby gives here and there.</p>
<h2>Object.inspect</h2>
<p>Currently:</p>
<pre>
=> #<Object:0xb7cd5ed0>
=> #<Book:0xb7cc4d00 @title="Gorbachev's Finger Tricks",
@author="Gorbachev", @length=150>
=> #<File:ruby.h>
</pre>
<p>Slight polish:</p>
<pre>
=> (Object)
=> (Book @title="Gorbachev's Finger Tricks"
@author="Gorbachev" @length=150)
=> (File ruby.h)
</pre>
<h2>Proc.inspect</h2>
<p>Currently:</p>
<pre>
=> #<Proc:0xb7d19aa0@(irb):4>
</pre>
<p>Show arity?</p>
<pre>
=> (Proc |a,*b|)
</pre>
<h2>Backtraces and Warnings</h2>
<p>Currently:</p>
<pre>
bin/tiny_wm.rb:4: parse error, unexpected '='
$d = = X11::Display.new
^
bin/tiny_wm.rb:2:in `require': no such file to load -- X11/Display (LoadError)
from bin/tiny_wm.rb:2
ArgumentError: wrong number of arguments (3 for 1)
from (irb):1:in `gets'
from (irb):1
/home/why/bin/warn.rb:2: warning: parenthesize argument(s) for future version
</pre>
<p>Slight polish:</p>
<pre>
ParseError in bin/tiny_wm.rb (line 4):
unexpected '='
> $d = = X11::Display.new
> ^
LoadError in bin/tiny_wm.rb (line 2) at `require':
no such file to load -- X11/Display
from bin/tiny_wm.rb (line 2)
ArgumentError in irb (line 1) at `gets':
wrong number of arguments (3 for 1)
from irb (line 1)
Warning in /home/why/bin/warn.rb (line 2):
parenthesize argument(s) for future version
</pre>
<p>We should avoid wrapping the `message’ inside the initial line of a backtrace. It is often the most crucial part.</p>
<p>It sure would be nice to have the ability to customize the look of your backtraces. To have backtrace objects like in <a href="http://blog.fallingsnow.net/articles/2005/07/11/sydney-developer-preview-release-1-out">Sydney</a>. I’d like to brightly <span class="caps">ANSI</span> highlight the backtrace line which refers to <code>$PROGRAM_NAME</code>, give a dark color to trace lines from the stdlib and medium highlight everything else.</p>
<p>I’m sure all of you out there can give help here. But you know what I mean about some of these?</p>
<a href="http://redhanded.hobix.com/inspect/ideasForRuby20Veneer.html" target="_blank">http://redhanded.hobix.com/inspect/ideasForRuby20Veneer.html</a>
<h2>Object.inspect</h2>
<p>Currently:</p>
<pre>
=> #<Object:0xb7cd5ed0>
=> #<Book:0xb7cc4d00 @title="Gorbachev's Finger Tricks",
@author="Gorbachev", @length=150>
=> #<File:ruby.h>
</pre>
<p>Slight polish:</p>
<pre>
=> (Object)
=> (Book @title="Gorbachev's Finger Tricks"
@author="Gorbachev" @length=150)
=> (File ruby.h)
</pre>
<h2>Proc.inspect</h2>
<p>Currently:</p>
<pre>
=> #<Proc:0xb7d19aa0@(irb):4>
</pre>
<p>Show arity?</p>
<pre>
=> (Proc |a,*b|)
</pre>
<h2>Backtraces and Warnings</h2>
<p>Currently:</p>
<pre>
bin/tiny_wm.rb:4: parse error, unexpected '='
$d = = X11::Display.new
^
bin/tiny_wm.rb:2:in `require': no such file to load -- X11/Display (LoadError)
from bin/tiny_wm.rb:2
ArgumentError: wrong number of arguments (3 for 1)
from (irb):1:in `gets'
from (irb):1
/home/why/bin/warn.rb:2: warning: parenthesize argument(s) for future version
</pre>
<p>Slight polish:</p>
<pre>
ParseError in bin/tiny_wm.rb (line 4):
unexpected '='
> $d = = X11::Display.new
> ^
LoadError in bin/tiny_wm.rb (line 2) at `require':
no such file to load -- X11/Display
from bin/tiny_wm.rb (line 2)
ArgumentError in irb (line 1) at `gets':
wrong number of arguments (3 for 1)
from irb (line 1)
Warning in /home/why/bin/warn.rb (line 2):
parenthesize argument(s) for future version
</pre>
<p>We should avoid wrapping the `message’ inside the initial line of a backtrace. It is often the most crucial part.</p>
<p>It sure would be nice to have the ability to customize the look of your backtraces. To have backtrace objects like in <a href="http://blog.fallingsnow.net/articles/2005/07/11/sydney-developer-preview-release-1-out">Sydney</a>. I’d like to brightly <span class="caps">ANSI</span> highlight the backtrace line which refers to <code>$PROGRAM_NAME</code>, give a dark color to trace lines from the stdlib and medium highlight everything else.</p>
<p>I’m sure all of you out there can give help here. But you know what I mean about some of these?</p>
<a href="http://redhanded.hobix.com/inspect/ideasForRuby20Veneer.html" target="_blank">http://redhanded.hobix.com/inspect/ideasForRuby20Veneer.html</a>