[#17198] enhancing Ruby error messages for out of the bound constant Fixnum? — Guillaume Cottenceau <gc@...>

Hi,

11 messages 2001/07/03

[#17206] /* */ comments — Dave Thomas <Dave@...>

43 messages 2001/07/04
[#17207] Re: /* */ comments — Stephen White <spwhite@...> 2001/07/04

On Wed, 4 Jul 2001, Dave Thomas wrote:

[#17251] Re: /* */ comments — Sean Chittenden <sean-ruby-talk@...> 2001/07/04

> Over on http://www.rubygarden.org, dv posted a patch to parse.y that

[#17268] Re: /* */ comments — matz@... (Yukihiro Matsumoto) 2001/07/05

Hi,

[#17212] Ruby 1.6.4 Win32 .exe installer question — A Bull in the China Shop of Life <feoh@...>

Folks;

11 messages 2001/07/04

[#17225] Re: /* */ comments — Arnaud Meuret <ameuret@...4you.com>

|From: Mark Slagell [mailto:ms@iastate.edu]

17 messages 2001/07/04

[#17240] Ruby Mascot/logo — "Kevin Powick" <kpowick@...>

Hi there.

14 messages 2001/07/04

[#17281] Inheritance — "Aleksei Guzev" <aleksei.guzev@...>

15 messages 2001/07/05
[#17282] Re: Inheritance — ts <decoux@...> 2001/07/05

>>>>> "A" == Aleksei Guzev <aleksei.guzev@bigfoot.com> writes:

[#17348] Adding a method to a class at the top-level — Guillaume Cottenceau <gc@...>

Comrades,

14 messages 2001/07/05

[#17482] Aliases for class methods — "HarryO" <harryo@...>

Say I wanted to write my own version of File#open that adds some

23 messages 2001/07/08

[#17511] Ruby on Slashdot — jweirich@...

Ruby is currently mentioned on Slashdot. I posted some references.

29 messages 2001/07/08
[#17512] Re: Ruby on Slashdot — Tobias Reif <tobiasreif@...> 2001/07/08

Interesting...

[#17518] Re: Ruby on Slashdot — matz@... (Yukihiro Matsumoto) 2001/07/09

Hi,

[#17519] Re: Ruby on Slashdot — "James (ruby-talk)" <ruby@...> 2001/07/09

> |I thought about that too; what about Ruby being a standard?

[#17525] Re: Ruby on Slashdot — matz@... (Yukihiro Matsumoto) 2001/07/09

Hi,

[#17536] Re: Ruby on Slashdot — David Alan Black <dblack@...> 2001/07/09

Hello --

[#17572] Re: Constants and Variables — "HarryO" <harryo@...>

> If you want objects that don't change, try Object#freeze,

25 messages 2001/07/10

[#17732] Re: Array#sort! returns nil when array empty — hfulton@...

> Array#sort! returns nil if the array is empty, whereas ri

32 messages 2001/07/12
[#17736] Re: Array#sort! returns nil when array empty — Paul Brannan <pbrannan@...> 2001/07/12

On Fri, 13 Jul 2001 hfulton@pop-server.austin.rr.com wrote:

[#17739] Re: Array#sort! returns nil when array empty — ts <decoux@...> 2001/07/12

>>>>> "P" == Paul Brannan <pbrannan@atdesk.com> writes:

[#17746] Re: Array#sort! returns nil when array empty — Paul Brannan <pbrannan@...> 2001/07/12

On Fri, 13 Jul 2001, ts wrote:

[#17747] What is Array#- ? — Jim Freeze <jim@...> 2001/07/12

While following the Array thread, I noticed the minus

[#17752] Re: What is Array#- ? — Dave Thomas <Dave@...> 2001/07/12

Jim Freeze <jim@freeze.org> writes:

[#17753] Re: What is Array#- ? — Jim Freeze <jim@...> 2001/07/12

On Fri, 13 Jul 2001, Dave Thomas wrote:

[#17833] Extending objects — "Aleksei Guzev" <aleksei.guzev@...>

16 messages 2001/07/14
[#17834] Ruby-newbie seeks help with Rubywin starting IRB — "Euan Mee" <lucid@...> 2001/07/14

Once I fire up Rubywin, and then invoke _R_uby _I_rb from the

[#17839] Re: Ruby-newbie seeks help with Rubywin starting IRB — A Bull in the China Shop of Life <feoh@...> 2001/07/14

At 07:05 PM 7/14/01 +0900, Euan Mee spewed forth:

[#17859] Re: Creating methods on the fly — "HarryO" <harryo@...>

I

18 messages 2001/07/15

[#17925] Movement in scripting language communities to integrate XML-RPC — gsemones@... (Guerry Semones)

Greetings,

20 messages 2001/07/16
[#17934] Re: Movement in scripting language communities to integrate XML-RPC — Tobias Reif <tobiasreif@...> 2001/07/16

"out of the box" by including

[#18018] Broadcasting data — "HarryO" <harryo@...>

Does someone have an example of broadcasting data around a network using

12 messages 2001/07/18

[#18023] [ANN] libxslt Rubified! — Wai-Sun Chia <waisun.chia@...>

Hello,

16 messages 2001/07/18
[#18024] Re: [ANN] libxslt Rubified! — TAKAHASHI Masayoshi <maki@...> 2001/07/18

Wai-Sun Chia <waisun.chia@compaq.com> wrote:

[#18100] Looking for Ruby programming exercises — Wayne Vucenic <wvucenic@...> 2001/07/19

I've been learning Ruby, mostly with the Pickaxe book, and it's going

[#18188] Newbie. Sinking fast. Please help. — Matt <matt@...>

I bought Programming Ruby a number of months back and finally have an opportunity to try out Ruby. However, I can't get it to build. Actually, that's not quite accurate. It builds fine. It won't pass 'make test'.

12 messages 2001/07/20

[#18193] Re: 99 bottles of beer — "Dat Nguyen" <thucdat@...>

18 messages 2001/07/20
[#18204] Re: 99 bottles of beer — Glen Starchman <glen@...> 2001/07/20

99.downto(0){|x|w=" on the wall";u="#{x!=0?eval(x.to_s):'no more'}

[#18306] Ruby as opposed to Python? — "Mark Nenadov" <mnenadov@...>

Hello. I have toyed with the idea of trying Ruby out for some time now.

118 messages 2001/07/22
[#18759] Re: Ruby as opposed to Python? — Paul Prescod <paulp@...> 2001/07/29

Yukihiro Matsumoto wrote:

[#18774] Re: Ruby as opposed to Python? — "Florian G. Pflug" <fgp@...> 2001/07/30

On Mon, Jul 30, 2001 at 05:58:22AM +0900, Paul Prescod wrote:

[#18393] Trouble Using FXRuby on cygwin/Windows NT — rgilbert1@... (Robbie Gilbert)

Hi,

10 messages 2001/07/23

[#18566] Which database should I use? — Urban Hafner <the-master-of-bass@...>

Hello everybody,

17 messages 2001/07/26
[#18575] Re: Which database should I use? — Urban Hafner <the-master-of-bass@...> 2001/07/26

[#18582] Re: Which database should I use? — Michael Neumann <neumann@...> 2001/07/26

Urban Hafner wrote:

[ruby-talk:17627] Re: low-level TCP/IP manipulations?

From: <ale@...>
Date: 2001-07-10 18:40:39 UTC
List: ruby-talk #17627

On Tue, 10 Jul 2001, Yukihiro Matsumoto wrote:

> Hi,
> 
> In message "[ruby-talk:17598] Re: low-level TCP/IP manipulations?"
>     on 01/07/10, Wai-Sun Chia <waisun.chia@msa.dec.com> writes:
> 
> |> I should have put "default: break" explicitly though.
> |
> |You're absolutely, right.
> |
> |But you can't blame me as I'm used to seeing "default:" in switch 
> |statements..(to pass code review all switches MUST have defaults) ;-)
> 
> Yes, alright.  I admit it's my bad habit. ;-)

To help you out, here's a script that finds switches without
"default:" block for you. When you run it, you'll see that your bad habit
has been very bad (60 non-defaulted switches), but will be cured in no
time once you see where they are :).

Please, run it like

         ruby -n find_switches.rb *.c

An example output for ruby 1.6.4 sources is appended after the source
code.


    - Aleksi

Ps. Don't mind getting errors from lex.c and parse.c, since those bad
codes aren't your mistakes :).





switches = [] unless switches
line_no  = 0  unless line_no
Switch   = nil unless Switch
  
BEGIN {
  # let's initialize a stack of switches and line number counter 
  # for the current file
  switches = []
  line_no  = 0
  
  Switch = Struct.new("Switch", :switch_line, :indentation,
		      :found_default_line)
}

line_no += 1

# remember everytime we find a switch
$_.grep(/(\s*?)switch\s*\(/) do |m|
  switches.push Switch.new(line_no, $1, nil)
end

# add line number if found 'default:',
# and output error if found without beginning switch
$_.grep(/default\s*:/) do |m|
  if switches.size > 0
    switches.last.found_default_line = line_no
  else
    puts "\nFound default without appropriate switch on " + 
         "file #{$<.to_s} at row #{line_no}\n\n"
  end
end

# try to find switch closing '}'
# and output error if no 'default:' was found in switch
if switches.size > 0
  closing_brace = Regexp.escape(switches.last.indentation+"}")
  $_.grep(Regexp.new("^"+closing_brace)) do |m|
    if switches.last.found_default_line
      # all is right, so let's be quiet
      # puts "Found default for switch on file #{$<.to_s} "+
      #      "at row #{switches.last.switch_line} on row "+
      #      "#{switches.last.found_default_line}"
    else
      puts "Missing 'default:' for switch on file #{$<.to_s} " +
	   "at row #{switches.last.switch_line}, closing " +
	   "#{line_no}."
    end
    switches.pop
  end
end


# lastly check if any switchs are still open
# when we change a file
filename = $<.to_s unless filename

if filename != $<.to_s
  if switches.size > 0
    puts "\nThe file #{filename} changes but these " +
         "switches are still open"
    switches.each do |switch|
      puts "switch on line #{switch.switch_line} with " +
           "indentation #{switch.indentation.inspect}"
    end
    puts
  end

  # reset tracking
  switches = []
  line_no = 1
  filename = $<.to_s
end














Missing 'default:' for switch on file array.c at row 1198, closing 1216.
Missing 'default:' for switch on file dir.c at row 508, closing 524.
Missing 'default:' for switch on file dln.c at row 493, closing 503.
Missing 'default:' for switch on file dln.c at row 538, closing 554.
Missing 'default:' for switch on file dln.c at row 556, closing 572.
Missing 'default:' for switch on file dln.c at row 714, closing 744.
Missing 'default:' for switch on file dln.c at row 782, closing 792.
Missing 'default:' for switch on file dln.c at row 803, closing 816.
Missing 'default:' for switch on file dln.c at row 818, closing 829.
Missing 'default:' for switch on file eval.c at row 1486, closing 1492.
Missing 'default:' for switch on file eval.c at row 1525, closing 1530.
Missing 'default:' for switch on file eval.c at row 3655, closing 3660.
Missing 'default:' for switch on file eval.c at row 6198, closing 6208.
Missing 'default:' for switch on file eval.c at row 7157, closing 7187.
Missing 'default:' for switch on file eval.c at row 7190, closing 7203.
Missing 'default:' for switch on file file.c at row 1563, closing 1570.
Missing 'default:' for switch on file file.c at row 1620, closing 1687.
Missing 'default:' for switch on file file.c at row 1698, closing 1705.
Missing 'default:' for switch on file file.c at row 1715, closing 2079.
Missing 'default:' for switch on file gc.c at row 441, closing 580.
Missing 'default:' for switch on file gc.c at row 764, closing 771.
Missing 'default:' for switch on file gc.c at row 852, closing 863.
Missing 'default:' for switch on file io.c at row 1277, closing 1287.
Missing 'default:' for switch on file io.c at row 1305, closing 1316.
Missing 'default:' for switch on file io.c at row 2951, closing 3003.

The file lex.c changes but these switches are still open
switch on line 51 with indentation "  "

Missing 'default:' for switch on file pack.c at row 399, closing 542.

Found default without appropriate switch on file parse.c at row 2865

Missing 'default:' for switch on file parse.c at row 6011, closing 6037.
Missing 'default:' for switch on file parse.c at row 6056, closing 6067.
Missing 'default:' for switch on file parse.c at row 7018, closing 7024.
Missing 'default:' for switch on file parse.c at row 6985, closing 7120.
Missing 'default:' for switch on file parse.c at row 7293, closing 7302.
Missing 'default:' for switch on file parse.c at row 7304, closing 7313.
Missing 'default:' for switch on file parse.c at row 7455, closing 7462.
Missing 'default:' for switch on file parse.c at row 7579, closing 7604.
Missing 'default:' for switch on file parse.c at row 7573, closing 7652.

The file parse.c changes but these switches are still open
switch on line 2893 with indentation "  "

Missing 'default:' for switch on file re.c at row 146, closing 159.
Missing 'default:' for switch on file re.c at row 166, closing 179.
Missing 'default:' for switch on file re.c at row 302, closing 315.
Missing 'default:' for switch on file re.c at row 1084, closing 1093.
Missing 'default:' for switch on file regex.c at row 1093, closing 1117.
Missing 'default:' for switch on file regex.c at row 2913, closing 2928.
Missing 'default:' for switch on file regex.c at row 2935, closing 2950.
Missing 'default:' for switch on file regex.c at row 2767, closing 3093.
Missing 'default:' for switch on file regex.c at row 2765, closing 3105.
Missing 'default:' for switch on file regex.c at row 3699, closing 4345.
Missing 'default:' for switch on file regex.c at row 3697, closing 4372.
Missing 'default:' for switch on file regex.c at row 4499, closing 4516.
Missing 'default:' for switch on file signal.c at row 315, closing 336.
Missing 'default:' for switch on file signal.c at row 501, closing 520.
Missing 'default:' for switch on file signal.c at row 531, closing 565.
Missing 'default:' for switch on file sprintf.c at row 39, closing 64.
Missing 'default:' for switch on file sprintf.c at row 65, closing 73.
Missing 'default:' for switch on file sprintf.c at row 77, closing 95.
Missing 'default:' for switch on file sprintf.c at row 96, closing 100.
Missing 'default:' for switch on file sprintf.c at row 453, closing 459.
Missing 'default:' for switch on file sprintf.c at row 499, closing 504.
Missing 'default:' for switch on file sprintf.c at row 569, closing 578.
Missing 'default:' for switch on file st.c at row 490, closing 507.
Missing 'default:' for switch on file string.c at row 2619, closing 2628.
Missing 'default:' for switch on file time.c at row 459, closing 477.


In This Thread

Prev Next