Declaring a variable as "EMPTY" is the same as declaring as "object": As
Ted said, has no programmatic effects, but in this case has no effect even
for Intellisense.

When I want Intellisense for an EMPTY object I define a CUSTOM class with
the properties of the EMPTY object, so I (or the team) can benefit of
Intellisense for the EMPTY object, like this example:

* TEST.PRG
LOCAL loReg as C_REG OF TEST.PRG
loReg = CREATEOBJECT("EMPTY")
loReg.AddProperty("name", value)
loReg.AddProperty("address", value)
...
RETURN

DEFINE CLASS C_REG AS CUSTOM
   name = ""
   address = ""
ENDDEFINE


In some situations this is very useful.

Fernando.-



2018-01-30 23:44 GMT+01:00 Paul H. Tarver <[email protected]>:

> I think I accidently did something similar recently and I think using
> createobject('Empty') may have been a cleaner method of doing what I did.
>
> I was trying to create an object I could use to store say a dozen or more
> attributes and then pass the reference to the object as one parameter
> rather
> than a dozen or more separate parameters. This need comes up from time to
> time when I want to build a complex method that uses only parameters to do
> the same job repeatedly as I fall through a large table. In this specific
> situation, I was looping through 50 or 60 columns on about 1,000 records.
> Not sure if there is any performance benefit one way or another in using
> lots of parameters as compared to using an object references, but it sure
> made the development of the two-part processing a lot easier.
>
> The way I did it was to add a custom object to my Class Library and then
> use
> NewObject to create the object within my main code like this:
>
> loTaxObject = NEWOBJECT("Std_VarObj","toolkit")
> loTaxObject.AddProperty('ocClientId', '')
> loTaxObject.AddProperty('ocEmplId', '')
> loTaxObject.AddProperty('ocEmplName', '')
> ....
> etc.
>
> I then fall through a scan...endscan routine where we populate the various
> properties on the object and then pass the loTaxObject as a parameter to a
> different method which then uses all of the properties to the final
> processing. Not sure whether this is good programming style or not, but it
> worked like I wanted and I think I'll be using something like this again in
> the near future. Then I saw the CreateObject('Empty') command mentioned on
> this thread.
>
> Wouldn't that accomplish the same thing I did via NewObject with a
> pre-established class?
>
> Thanks!
>
> Paul
>
> -----Original Message-----
> From: ProfoxTech [mailto:[email protected]] On Behalf Of Frank
> Cazabon
> Sent: Tuesday, January 30, 2018 2:13 PM
> To: [email protected]
> Subject: Re: Declaring variable as "Empty" ???
>
> I've seen it used as a lightweight class.
>
> http://fox.wikis.com/wc.dll?Wiki~EmptyClass
>
> On 30 January 2018 14:50:57 GMT-04:00,
> [email protected] wrote:
> >Saw this today while looking for other stuff:
> >https://www.screencast.com/t/PyvZvy53oZFu
> >
> >Never saw anyone declare a variable AS "Empty" before?  I guess that's
> >basically this:  loMenuItem = CREATEOBJECT("Empty")  (although you'd
> >still have to write that code, of course, since no instantiation in
> >declaration in VFP).
> >
> >???
> >
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/cagq_jukmt3cl8y0bmxdaufsgqz1r0-tx4nmekuyaoeq3z21...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to