Index
2016-11-18 02:34Thierry Nivelet : define class xx twice
2016-11-18 02:57Fernando D. Bozzo : Re: define class xx twice
2016-11-18 12:14Gene Wirchenko : Re: define class xx twice
2016-11-18 17:31Fernando D. Bozzo : Re: define class xx twice
2016-11-18 17:39Gene Wirchenko : Re: define class xx twice
Back to top
define class xx twice

Author: Thierry Nivelet

Posted: 2016-11-18 02:34:02   Link

Hi,

Just to be sure, would this behavior always be true wherever both DEFINE

CLASS are located?

dupClassTest = CreateObject('dupClassTest')

? dupClassTest.dupClassTest && 'duplicate'

DEFINE CLASS dupClassTest as Custom

dupClassTest = 'original'

enddefine

DEFINE CLASS dupClassTest as Custom

dupClassTest = 'duplicate'

enddefine

--

Thierry Nivelet

FoxInCloud

Give your VFP app a second life in the cloud

http://foxincloud.com/

_______________________________________________

Post Messages to: ProFox@leafe.com

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/1c89176c-f329-b483-95c9-86042c884a83@foxincloud.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.

©2016 Thierry Nivelet
Back to top
Re: define class xx twice

Author: Fernando D. Bozzo

Posted: 2016-11-18 02:57:13   Link

Yes, this is the same behaviour as for procedures, the last defined or

loaded overwrites the previous.

This is because there can't be more than one procedure/class with the same

name on memoty at the same time.

In the case of classes you can use NewObject to select from which library

instantiate a class definition, but for multiple objects this is more

slower than createobject.

2016-11-18 9:34 GMT+01:00 Thierry Nivelet <tnivelet@foxincloud.com>:

> Hi,

>

> Just to be sure, would this behavior always be true wherever both DEFINE

> CLASS are located?

>

> dupClassTest = CreateObject('dupClassTest')

>

> ? dupClassTest.dupClassTest && 'duplicate'

>

> DEFINE CLASS dupClassTest as Custom

> dupClassTest = 'original'

> enddefine

>

> DEFINE CLASS dupClassTest as Custom

> dupClassTest = 'duplicate'

> enddefine

>

> --

>

> Thierry Nivelet

> FoxInCloud

> Give your VFP app a second life in the cloud

> http://foxincloud.com/

>

>

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

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_Ju=S0b87f1nmdNMVVaqnZDgYm+woOEP+_W2CWUazL0u7-g@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.

©2016 Fernando D. Bozzo
Back to top
Re: define class xx twice

Author: Gene Wirchenko

Posted: 2016-11-18 12:14:08   Link

At 00:57 2016-11-18, "Fernando D. Bozzo" <fdbozzo@gmail.com> wrote:

>Yes, this is the same behaviour as for procedures, the last defined or

>loaded overwrites the previous.

Maybe. It is undefined behaviour so you can not count on it

being one way or the other.

>This is because there can't be more than one procedure/class with the same

>name on memoty at the same time.

A questionable assumption. What about

do someproc in locationa

do someproc in locationb

Since it is not defined exactly what VFP stores in memory codewise,

it is not impossible that both could be.

>In the case of classes you can use NewObject to select from which library

>instantiate a class definition, but for multiple objects this is more

>slower than createobject.

Having been bit by a duplicate method name some months back, I

think there really should be a compiler error message for duplicates.

[snipped previous]

Sincerely,

Gene Wirchenko

_______________________________________________

Post Messages to: ProFox@leafe.com

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/53b9181cdfcb7b82ebe52b51c4179e0e@mtlp000086

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

©2016 Gene Wirchenko
Back to top
Re: define class xx twice

Author: Fernando D. Bozzo

Posted: 2016-11-18 17:31:36   Link

Hi Gene:

2016-11-18 19:14 GMT+01:00 Gene Wirchenko <genew@telus.net>:

> At 00:57 2016-11-18, "Fernando D. Bozzo" <fdbozzo@gmail.com> wrote:

>

>> Yes, this is the same behaviour as for procedures, the last defined or

>> loaded overwrites the previous.

>>

>

> Maybe. It is undefined behaviour so you can not count on it being

> one way or the other.

>

> This is because there can't be more than one procedure/class with the same

>> name on memoty at the same time.

>>

>

> A questionable assumption. What about

> do someproc in locationa

> do someproc in locationb

> Since it is not defined exactly what VFP stores in memory codewise, it is

> not impossible that both could be.

>

That is precisely why I've talked about "procedure/class on memory",

because the only way to have them loaded on memory is with SET PROCEDURE

and SET CLASSLIB, and in this cases the last one is the winner.

"do someproc in locationx" or "NewObject" does not use nothing "in memory",

because they load from the indicated resource directly, hence, does not

apply,

>

> In the case of classes you can use NewObject to select from which library

>> instantiate a class definition, but for multiple objects this is more

>> slower than createobject.

>>

>

>

> Having been bit by a duplicate method name some months back, I think

> there really should be a compiler error message for duplicates.

>

> [snipped previous]

>

> Sincerely,

>

> Gene Wirchenko

>

>

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

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_JuncEdVFfMVo9eTnhZPOpYG4n1iZJh-22HxyVK9C0Oc+yQ@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.

©2016 Fernando D. Bozzo
Back to top
Re: define class xx twice

Author: Gene Wirchenko

Posted: 2016-11-18 17:39:53   Link

At 15:31 2016-11-18, "Fernando D. Bozzo" <fdbozzo@gmail.com> wrote:

[snip]

>"do someproc in locationx" or "NewObject" does not use nothing "in memory",

>because they load from the indicated resource directly, hence, does not

>apply,

You do not know that. You are guessing. It may be a perfectly

reasonable guess, but it is still just a guess.

How VFP decides to cache code is nothing I have seen

documented. I have occasionally gotten into trouble with this to the

point where I have simply closed VFP and restarted it, because I

could not get the cache dropped. This includes using clear

program. A bug in VFP? Maybe. A bug in my code? Quite

possibly. But I have been unable to clear the cache short of closing VFP.

[snip]

Sincerely,

Gene Wirchenko

_______________________________________________

Post Messages to: ProFox@leafe.com

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/9aabd014b4286b3ca161431efce95a63@mtlp000085

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

©2016 Gene Wirchenko