I can't find out where the error is

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

I can't find out where the error is

ZuLuuuuuu
Hello,

When working with GNU Smalltalk the most notable difficulty I face is that I
can't understand where the errors are. It does not say on which line the error
is unless it is a syntax error.

For example, my last program gives an error like this:

Object: nil error: did not understand #value
MessageNotUnderstood(Exception)>>signal
UndefinedObject(Object)>>doesNotUnderstand: #value
True>>and:
UndefinedObject>>executeStatements

I guess there is an object which is sent a "value" message but the object is a
"nil" object so it does not understand the message. But I have more than one
"value" messages so I absolutely don't know where the error is. It would be very
helpful if all the errors were represented with line numbers.

Also does anyone else have the same problem on Windows XP, that when there is an
error, then gst crashes?



_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Canol Gökel
Reply | Threaded
Open this post in threaded view
|

Re: I can't find out where the error is

S11001001
Canol Gokel <[hidden email]> writes:

> Object: nil error: did not understand #value
> MessageNotUnderstood(Exception)>>signal
> UndefinedObject(Object)>>doesNotUnderstand: #value
> True>>and:
> UndefinedObject>>executeStatements
>
> I guess there is an object which is sent a "value" message but the
> object is a "nil" object so it does not understand the message. But I
> have more than one "value" messages so I absolutely don't know where
> the error is.

Well, considering that the backtrace is innermost-first, it's pretty
clear that the specific #value message is one within the method
True>>and:, not one you wrote yourself (unless you changed that method
for some reason).  So you are looking for an #and: that you wrote, not a
#value.  I would guess that you passed a non-block as the argument.

If you want a short-circuiting variant of #and: that doesn't require
making the argument as a block, you'll have to use Presource:

NoCandy.MyCodeMindset installIn: MyNamespace!
MyNamespace.MyCodeMindset messageMacroDictionary
    at: #andf:
    put: (NoCandy.Presrc.PatternMacro
              given: '`@test `andf: `@consequent'
              use: '`@test and: [`@consequent]')!

> It would be very helpful if all the errors were represented with line
> numbers.

Indeed.

--
But you know how reluctant paranormal phenomena are to reveal
themselves when skeptics are present. --Robert Sheaffer, SkI 9/2003


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: I can't find out where the error is

ZuLuuuuuu
Stephen Compall <s11 <at> member.fsf.org> writes:

>
> Well, considering that the backtrace is innermost-first, it's pretty
> clear that the specific #value message is one within the method
> True>>and:, not one you wrote yourself (unless you changed that method
> for some reason).  So you are looking for an #and: that you wrote, not a
> #value.  I would guess that you passed a non-block as the argument.
>

But I also have a lot of and: messages in my code so again finding the right one
is difficult.

Actually, I corrected the error by trial and error method ( ;-) ), but it is
really difficult and I face this situation a lot in GNU Smalltalk.



_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Canol Gökel
Reply | Threaded
Open this post in threaded view
|

Re: Re: I can't find out where the error is

S11001001
Canol Gokel <[hidden email]> writes:
> But I also have a lot of and: messages in my code so again finding the
> right one is difficult.

However, this one was part of an #evaluate: or a top-level statement.
Even if you were to update the backtrace to use line number info from
the CompiledCode, this would not help you with #evaluate:d code.

Otherwise, the backtrace would tell you which method of yours the #and:
was in.  If this is an issue for normal methods, that's a good sign your
methods are too long.

(Of course, I'm making broad generalizations, not seeing your code.)

--
But you know how reluctant paranormal phenomena are to reveal
themselves when skeptics are present. --Robert Sheaffer, SkI 9/2003


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: I can't find out where the error is

Paolo Bonzini-2
In reply to this post by S11001001

>> It would be very helpful if all the errors were represented with line
>> numbers.
>
> Indeed.

Can you make an issue report?

Thanks,

Paolo



_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk