Discussion:
Odd Error Message
(too old to reply)
Gene Wirchenko
2012-12-27 23:18:20 UTC
Permalink
Dear VFPers:

I just got an odd error message that had me puzzled for a few
minutes:
Expression is not valid outside of WITH/ENDWITH.
The error line was a return statement:
return .t
The error message is technically accurate but is a bit confusing. The
error is that I forgot the second period of ".t.".

Sincerely,

Gene Wirchenko
Dan Freeman
2012-12-28 15:50:28 UTC
Permalink
Post by Gene Wirchenko
I just got an odd error message that had me puzzled for a few
Expression is not valid outside of WITH/ENDWITH.
return .t
The error message is technically accurate but is a bit confusing. The
error is that I forgot the second period of ".t.".
Sincerely,
Gene Wirchenko
Strange, but not the strangest error in VFP's vocabulary. :-)

And the error message itself is actually wrong. RETURN should *never*
be used inside WITH/ENDWITH. That's a big cause of C0000005 errors.

Dan
Bernhard Sander
2013-01-03 12:04:13 UTC
Permalink
Hi Gene,
Post by Gene Wirchenko
I just got an odd error message that had me puzzled for a few
Expression is not valid outside of WITH/ENDWITH.
return .t
The error message is technically accurate but is a bit confusing. The
error is that I forgot the second period of ".t.".
Hm, RETURN <value> is the common way to return the value of a function call.

In your line, .t is correct syntax, but only allowed, if it is contained in a
WITH/ENDWITH structure. Then .t is a property of the WITH-object. So the error
message is very correct.

Regards
Bernhard Sander
Gene Wirchenko
2013-01-03 17:52:54 UTC
Permalink
Post by Bernhard Sander
Post by Gene Wirchenko
I just got an odd error message that had me puzzled for a few
Expression is not valid outside of WITH/ENDWITH.
return .t
The error message is technically accurate but is a bit confusing. The
error is that I forgot the second period of ".t.".
Hm, RETURN <value> is the common way to return the value of a function call.
In my case, the value to return was .t.
Post by Bernhard Sander
In your line, .t is correct syntax, but only allowed, if it is contained in a
WITH/ENDWITH structure. Then .t is a property of the WITH-object. So the error
message is very correct.
Sure, but quite misleading. The error message made no mention of
the real error.

Sincerely,

Gene Wirchenko
Bernhard Sander
2013-01-04 11:20:21 UTC
Permalink
Hi Gene,
Post by Gene Wirchenko
Post by Gene Wirchenko
Expression is not valid outside of WITH/ENDWITH.
return .t
Sure, but quite misleading. The error message made no mention of
the real error.
I think, it exactly describes the error:
.t is valid inside of WITH/ENDWITH, but is not valid outside.

Indeed, the error message does not meet your intention.
I think, you can make a lot of money if you succeed to build such an error
interpreter...

Regards
Bernhard Sander
Dan Freeman
2013-01-04 17:50:52 UTC
Permalink
Post by Bernhard Sander
Hi Gene,
Post by Gene Wirchenko
Post by Gene Wirchenko
Expression is not valid outside of WITH/ENDWITH.
return .t
Sure, but quite misleading. The error message made no mention of
the real error.
.t is valid inside of WITH/ENDWITH, but is not valid outside.
Indeed, the error message does not meet your intention.
I think, you can make a lot of money if you succeed to build such an error
interpreter...
Regards
Bernhard Sander
It's an example of an error message being correct with surgical
precision but wrong at the same time. A normal situation for error
messages (or tech support).

Dan

Continue reading on narkive:
Loading...