[#1816] Ruby 1.5.3 under Tru64 (Alpha)? — Clemens Hintze <clemens.hintze@...>

Hi all,

17 messages 2000/03/14

[#1989] English Ruby/Gtk Tutorial? — schneik@...

18 messages 2000/03/17

[#2241] setter() for local variables — ts <decoux@...>

18 messages 2000/03/29

[ruby-talk:01728] Re: [Ruby] static buffers

From: Clemens Hintze <c.hintze@...>
Date: 2000-03-05 22:28:15 UTC
List: ruby-talk #1728
>>>>> "Dave" == Dave Thomas <Dave@Thomases.com> writes:

    Dave> Yukihiro Matsumoto <matz@netlab.co.jp> writes:

...

    Dave> What about using parameter passing semantics:

    Dave>   rescue FriendlyException(friendly)

    Dave> and then extend it to

    Dave>   rescue FriendlyException, UglyException(mixed)

    Dave> and

    Dave>   rescue (anyException)

    Dave> In a way, the Exception object you pass in _is_ like a
    Dave> parameter to the rescue pseudo-block.

I like that syntax, but didn't that get confused with method calling?
I know it is not the normal way, but nowadays I could code something
like this:

    exceptions = [SyntaxError, TypeError]

    def Exception(val)
       case val
         when 1
            SyntaxError
         when 2
            TypeError
       end
    end

    for i in 0..1
       begin
          raise exceptions[i]
       rescue Exception(1)
          print "Catched SyntaxError\n"
       rescue Exception(2)
          print "Catched TypeError\n"
       end
    end

That would not work anymore with your proposal, would it? Matz
proposal would also not work because I can do things like that now:

    def fn(*args)
       for arg in args
         print "type of '#{arg}' = #{arg.type}\n"
       end
    end

    fn SyntaxError => 12

So perhaps we need a new syntax like:

    rescue SyntaxError: friendly

But perhaps we want to use the ':' for named argument passing ... I do 
not know whether that would conflicts with it?

    Dave> Regards
    Dave> Dave

Regards too,
\cle

-- 
Clemens Hintze  mailto: c.hintze@gmx.net

In This Thread