Hello:
I am making some table modifications to my app. I completed the support part for one table then wanted to see the DE form for how I was going to add the columns. I got an interesting error when the support object for that table was being instantiated. This error was reported on the statement with the createobject() call: Expression is not valid outside of WITH/ENDWITH. The error number was 0.
The real cause of the error had to be in the class about to be instantiated. That was the only place I had changed. Well, I did find it there. I had missed a period and had defined a property incorrectly. The erroneous line was lrtepup=.f and should have been lrtepup=.f.
Note that VFP had not complained about the line during compilation.
Sincerely,
Gene Wirchenko
Sounds perfectly legit as an error to me. Property references inside the WITH/ENDWITH begin with a ".". VFP couldn't tell the difference between ".f" and a ".someproperty" reference so there would be no error at compile time. Not every scenario can be accounted for at compile time the way it works. Maybe they COULD HAVE errored it at compile time, since there was no active WITH/ENDWITH when the ".f" was encountered.
Fred
On Wed, May 10, 2017 at 11:32 AM, Gene Wirchenko genew@telus.net wrote:
Hello:
I am making some table modifications to my app. I completed thesupport part for one table then wanted to see the DE form for how I was going to add the columns. I got an interesting error when the support object for that table was being instantiated. This error was reported on the statement with the createobject() call: Expression is not valid outside of WITH/ENDWITH. The error number was 0.
The real cause of the error had to be in the class about to beinstantiated. That was the only place I had changed. Well, I did find it there. I had missed a period and had defined a property incorrectly. The erroneous line was lrtepup=.f and should have been lrtepup=.f.
Note that VFP had not complained about the line during compilation.Sincerely,
Gene Wirchenko
[excessive quoting removed by server]
Then again, trapping that error at compile time would prevent this code from working (which would probably be a good thing, <g>):
_screen.addobject("oz","textbox") _screen.oz.Visible = .t. WITH _screen.oz test() ENDWITH RETURN
FUNCTION test .left = 250 RETURN
Fred
On Wed, May 10, 2017 at 11:32 AM, Gene Wirchenko genew@telus.net wrote:
Hello:
I am making some table modifications to my app. I completed thesupport part for one table then wanted to see the DE form for how I was going to add the columns. I got an interesting error when the support object for that table was being instantiated. This error was reported on the statement with the createobject() call: Expression is not valid outside of WITH/ENDWITH. The error number was 0.
The real cause of the error had to be in the class about to beinstantiated. That was the only place I had changed. Well, I did find it there. I had missed a period and had defined a property incorrectly. The erroneous line was lrtepup=.f and should have been lrtepup=.f.
Note that VFP had not complained about the line during compilation.Sincerely,
Gene Wirchenko
[excessive quoting removed by server]
Fred:
Does that code actually run? Or does it error at runtime?
On Wed, May 10, 2017 at 2:53 PM, Fred Taylor fbtaylor@gmail.com wrote:
Then again, trapping that error at compile time would prevent this code from working (which would probably be a good thing, <g>):
_screen.addobject("oz","textbox") _screen.oz.Visible = .t. WITH _screen.oz test() ENDWITH RETURN
FUNCTION test .left = 250 RETURN
Fred
On Wed, May 10, 2017 at 11:32 AM, Gene Wirchenko genew@telus.net wrote:
Hello:
I am making some table modifications to my app. I completed thesupport part for one table then wanted to see the DE form for how I was going to add the columns. I got an interesting error when the support object for that table was being instantiated. This error was reported on the statement with the createobject() call: Expression is not valid outside of WITH/ENDWITH. The error number was 0.
The real cause of the error had to be in the class about to beinstantiated. That was the only place I had changed. Well, I did find it there. I had missed a period and had defined a property incorrectly. The erroneous line was lrtepup=.f and should have been lrtepup=.f.
Note that VFP had not complained about the line during compilation.Sincerely,
Gene Wirchenko
[excessive quoting removed by server]
I've found occasions where I've neglected to have something in front of the dot, principally due to using VB inheritance to copy and paste code from one method to another, and VFP seems to behave as if there is an implicit with...endwith scoped to the current object. IOW it will run and if the thing on the right side of the dot is a valid property, the code does not throw an error.
--
rk
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Ted Roche Sent: Wednesday, May 10, 2017 2:57 PM To: profoxtech@leafe.com Subject: Re: Weird Instantiation Bug
Fred:
Does that code actually run? Or does it error at runtime?
On Wed, May 10, 2017 at 2:53 PM, Fred Taylor fbtaylor@gmail.com wrote:
Then again, trapping that error at compile time would prevent this code from working (which would probably be a good thing, <g>):
_screen.addobject("oz","textbox") _screen.oz.Visible = .t. WITH _screen.oz test() ENDWITH RETURN
FUNCTION test .left = 250 RETURN
Fred
On Wed, May 10, 2017 at 11:32 AM, Gene Wirchenko genew@telus.net wrote:
Hello:
I am making some table modifications to my app. I completed thesupport part for one table then wanted to see the DE form for how I was going to add the columns. I got an interesting error when the support object for that table was being instantiated. This error was reported on the statement with the createobject() call: Expression is not valid outside of WITH/ENDWITH. The error number was 0.
The real cause of the error had to be in the class about to beinstantiated. That was the only place I had changed. Well, I did find it there. I had missed a period and had defined a property incorrectly. The erroneous line was lrtepup=.f and should have been lrtepup=.f.
Note that VFP had not complained about the line during compilation.Sincerely,
Gene Wirchenko
[excessive quoting removed by server]
I'm glad someone's paying attention...
--
rk
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Wednesday, May 10, 2017 3:42 PM To: profoxtech@leafe.com Subject: RE: Weird Instantiation Bug
On 2017-05-10 15:14, Richard Kaye wrote:
principally due to using VB inheritance to copy and paste code from one method to another, ....
ROFL!! I see what you did there. :D
It actually runs. Scary, huh!
Fred
On Wed, May 10, 2017 at 11:56 AM, Ted Roche tedroche@gmail.com wrote:
Fred:
Does that code actually run? Or does it error at runtime?
On Wed, May 10, 2017 at 2:53 PM, Fred Taylor fbtaylor@gmail.com wrote:
Then again, trapping that error at compile time would prevent this code from working (which would probably be a good thing, <g>):
_screen.addobject("oz","textbox") _screen.oz.Visible = .t. WITH _screen.oz test() ENDWITH RETURN
FUNCTION test .left = 250 RETURN
Fred
On Wed, May 10, 2017 at 11:32 AM, Gene Wirchenko genew@telus.net
wrote:
Hello:
I am making some table modifications to my app. I completed thesupport part for one table then wanted to see the DE form for how I was going to add the columns. I got an interesting error when the support object for that table was being instantiated. This error was reported
on
the statement with the createobject() call: Expression is not valid outside of WITH/ENDWITH. The error number was 0.
The real cause of the error had to be in the class about to beinstantiated. That was the only place I had changed. Well, I did find
it
there. I had missed a period and had defined a property incorrectly.
The
erroneous line was lrtepup=.f and should have been lrtepup=.f.
Note that VFP had not complained about the line during compilation.Sincerely,
Gene Wirchenko
[excessive quoting removed by server]