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
路路路
Brian Candler [mailto:B.Candler@pobox.com] wrote:
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 ?
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.
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.
路路路
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..