From: Markus Date: 2004-10-12T07:18:19+09:00 Subject: Re: quality of error messages On Mon, 2004-10-11 at 14:46, Austin Ziegler wrote: > On Fri, 8 Oct 2004 20:26:55 +0900, Brian Candler wrote: > > On Fri, Oct 08, 2004 at 08:06:27AM +0900, Yukihiro Matsumoto wrote: > > > |> % ./script.rb > > > |> script.rb:6: warning: inconsistent indentation level. > > > |> script.rb:13: parse error > > > |> > > > |> This should make it easy to find such errors. > > > > > > |That seems like a nice idea to me. This would be nearly the same as the > > > |autoindenter so, only that it does not indent but spit out warnings. > > > > > > I'm afraid that it might cause tab-space indentation war like in the > > > Python community. The issue is much smaller though, since it is not > > > mandatory. > > > > I think that you don't have to enforce any particular indentation style or > > amount of space on each line - only that it is consistent between begin and > > end. > > No, no, no, and NO! Austin. Pause. Take a deep breath. Let it out slowly. You are misunderstanding what has been discussed, and what has been implemented. There is no need for panic. What people are suggesting is a way to help them find missing 'end's in their code. At present, the error message is not particularly helpful. It gives no indication of where the problem might be. So what we have done is prototyped a way to guess where the error might be, based on common patterns of indentation. That is all. * It does not enforce, coerce, mandate, or even recommend any particular indentation style. * It does not alter the interpretation of any ruby program. * It does not generate any messages unless the program fails to parse, and only then in the case where a missing 'end' or '}' is likely. In that case, all it does is add a list of line numbers to the message (as warnings) indicating a small number of places where the error might be. > When I am writing code, I will often do: > > class Foo > def bar > : # some code here > p baz # a tracer to help me find a difficult bug > : # more code here > end > end And you may freely continue to do so. No one is saying otherwise. > Your suggestion would force me to indent the tracer -- which I have > *purposefully* overridden the auto-formatting by vim to insert -- > which leads me to the same idiocy that keeps me from Python as a first > point. There are several interesting points to discuss here, but I fear to raise them lest I upset you further. Perhaps later, once your main concerns have been addressed. > Tracer code is too useful to be bound by people who don't use editors > that help them write their code through use of automatic indentation > and/or folding. If you are using automation tools to help you write code presumably you have other, better ways of localizing missing 'end's. So you would never even see the warnings. If you (or others who code like you) would like the messages to be helpful to them as well, I suspect there may be a simple heuristic or two that would handle it. The indentation-reader uses a _very_ loose definition of salience already, to accommodate the wide range of styles found in the code I looked at. > This whole indentation-count idea is dumb. I agree that the idea you are reacting to may be is dumb, or at least ill advised in this context. But that is not the idea under discussion. If possible, I would be interested in hearing your thoughts on the actual idea, which is laid out here: http://blade.nagaokaut.ac.jp/ruby/ruby-core/3486 (including a link to my first attempt at implementing such as system). -- Markus