[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: quality of error messages

Peña, Botp

10/8/2004 9:57:00 AM

Brian Candler [mailto:B.Candler@pobox.com] wrote:

> I think in most cases not. For the most common missing 'end'
> error, the compiler detects it at the end of the file, and
> the line it thinks it pairs with is the first line of the
> file. Hence it localises the error to somewhere between the
> first line and last line of the file, which is not very helpful :-)
>
>[snip valid example]
> Since class definitions can occur within other classes (very
> useful), and 'def' can occur within another 'def' (not so
> useful for me), that's how it gets parsed.

yes, you're right. markus also explained sample in expressions too.

but the compiler does get a missing "end", right? But it does not know for
which begin.. I'd be a happing w "missing end" message though during a
syntax check..

As for determining for wc end,

1. maybe we introduce optional endclass, endif, enddef
2. maybe we do python style force indent

>
> Regards,
>
> Brian.

kind regards -botp



3 Answers

gabriele renzi

10/8/2004 10:02:00 AM

0

Peña, Botp ha scritto:


> As for determining for wc end,
>
> 1. maybe we introduce optional endclass, endif, enddef
> 2. maybe we do python style force indent
>

I don't understand: why people find it so hard to indent their code
by themself ? :)

Randy W. Sims

10/8/2004 10:32:00 AM

0

Peña, Botp wrote:
> 1. maybe we introduce optional endclass, endif, enddef

Like another poster, I'm in the habit of writing the close marker
immediately after the open marker. However, one style guide I sometimes
follow is that if a block exceeds one "page" or if I have some deeply
nested code, I will comment the end(s):

class Foo
def bar
puts 'bar'
end#bar
end # class Foo

or some variation on the theme.


Brian Candler

10/8/2004 11:48:00 AM

0

On Fri, Oct 08, 2004 at 06:56:39PM +0900, "Pe?a, Botp" wrote:
> >[snip valid example]
> > Since class definitions can occur within other classes (very
> > useful), and 'def' can occur within another 'def' (not so
> > useful for me), that's how it gets parsed.
>
> yes, you're right. markus also explained sample in expressions too.
>
> but the compiler does get a missing "end", right? But it does not know for
> which begin.. I'd be a happing w "missing end" message though during a
> syntax check..

Do you mean change

ert.rb:24: syntax error

to

ert.rb:24: missing 'end'

? It could help people who've seen this error for the first time, I guess.

Regards,

Brian.