Syntax checker?

Regardless of what the example does, my point is, how should it warn you?

By saying “foo might be undefined at line 2351”.

When?

When you ask it to. I’m not saying that such warnings should be output
by default.

If it worked just by looking at whether it may be undefined, then
surely it’d always warn you in the above situation?

Assuming that you asked it to, then yes. Or, potentially, there could
be a way to state, within the source code, for the benefit of this new
tool, that “Yeah, I already know that it looks like ‘foo’ might be
undefined on the next line (or in this function, or in this file).
Don’t bother telling me about that”.

I can see that it would probably help in a lot of cases

I agree.

but it would be
an annoying gripe in a lot of the more complex cases, which is where Ruby
shines.

Then don’t use it in such cases. Or, if you find it useful in some
complex case except for such annoyances, use it, but invoke the “Yeah,
I know” option described above.

On Thu, 08 Dec 2005 18:52:24 -0000, William E. Rubin
[email protected] wrote:

You’re asking it a question - “does FileUtils exist or not” - that it
is not intended to answer, and that it doesn’t claim to be able to
answer.

What it can do, however, is tell you that it looks like FileUtils might
not exist. And that would help in a whole lot of cases, no matter how
many pathological counterexamples you can come up with.

Well, I don’t see how it could really do that, without executing all
code
up to a certain point. Again, bear in mind that at the same point in
that
script, FileUtils may or may not be loaded, depending on what’s already
happened. How about if you had another script using the above:

def suicide
begin
eval File.read(‘roulette.rb’)
rescue
unless FileUtils
require ‘fileutils’
retry
end
end
end

Regardless of what the example does, my point is, how should it warn
you?
When? If it worked just by looking at whether it may be undefined,
then
surely it’d always warn you in the above situation?

I can see that it would probably help in a lot of cases, but it would be
an annoying gripe in a lot of the more complex cases, which is where
Ruby
shines. It’s that dynamicity that attracted me to Ruby, the fact that
pretty much everything is executable code, and I think it’d be an
enormous
shame to start imposing static-language requirements on it so a few
people
can avoid writing a few testcases …

Just my opinion…