[ruby-talk:02484] Re: 'in' vs. 'into'

From: mrilu <mrilu@...>
Date: 2000-04-15 00:17:17 UTC
List: ruby-talk #2484
On 14 Apr 2000, Dave Thomas wrote:

> I was writing about exceptions, and explaining the new
> 
>    rescue MyException in myVar
> 
> syntax, when I got to thinking. I'm wondering if it would read better
> if it said:
> 
>    rescue MyException into myVar
> 
> The 'into' gives a hint that the exception is going to be stored in
> the variable, while 'in' almost suggests that the variable has
> something to do with the exception class _before_ the exception is
> raised.
> 
> What do y'all think?

I completely agree. If I would make a decision here, I would take the
rescue MyException into myVar.

But, I haven't used Ruby exceptions extensively, so what am I to tell
something. I think I would use them way too conservatively, like in other
languages, and for example usages what Clemens show here 
([ruby-talk:01728] Re: [Ruby] static buffers) I would miss for quite a 
long time. So my bottom line is, that I don't know the implications of
this.

I'm not entirely sure what makes a keyword or reserved word. Is it a word
that can't stand in the code? If we can parse with some context here
I think

  rescue some-expression-to-evaluate-to-list-of-exception-classes 
    into var-name

would have 'into' associated only with rescue. If that is possible we have
no problem here, we should choose into for sure.

If we have a problem, I, for one, couldn't vote for new keyword without
thinking implications.

def into(raised)
  print raised, "do we have a problem?"
end
begin
  raise "I ask a question: "
rescue RuntimeError into $!
end

For me it seems that 'into' is such a good function name to be wasted.

I browsed the archive briefly and I think the discussion ended here

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

where Matz said he think some version might confuse parser. It would 
be great if he had some time to inform where we are heading now.



> 
> 
> Dave
> 

In This Thread

Prev Next