f



Odd Error Message

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
0
Gene
12/27/2012 11:18:20 PM
comp.databases.xbase.fox 802 articles. 0 followers. Post Follow

5 Replies
570 Views

Similar Articles

[PageSpeed] 37

Gene Wirchenko explained :
> 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

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


0
Dan
12/28/2012 3:50:28 PM
Hi Gene,

>       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.".

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

0
Bernhard
1/3/2013 12:04:13 PM
On Thu, 03 Jan 2013 13:04:13 +0100, Bernhard Sander <fuchs@kein.spam>
wrote:

>>       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.".
>
>Hm, RETURN <value> is the common way to return the value of a function call.

     In my case, the value to return was .t.

>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
0
Gene
1/3/2013 5:52:54 PM
Hi Gene,

>>>             Expression is not valid outside of WITH/ENDWITH.
>>> The error line was a return statement:
>>>             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

0
Bernhard
1/4/2013 11:20:21 AM
Bernhard Sander pretended :
> Hi Gene,
>
>>>>             Expression is not valid outside of WITH/ENDWITH.
>>>> The error line was a return statement:
>>>>             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

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


0
Dan
1/4/2013 5:50:52 PM
Reply: