Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with initial value of property
Message
De
29/09/2012 03:42:55
 
 
À
28/09/2012 19:19:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01553671
Message ID:
01553927
Vues:
66
>With only some extra code they would have re-initialized the properties, without almost no impact on the performance. So, your idea that it's optimization is incorrect.
>
>Elsewhere you seem to suggest that it is not the case in scx's. If that's true (what I believe to be), then that's an extra argument against the idea that it's optimization, isn't it?!
>

Peter, me and you are not into the mind of the VFP developer,
optimization or not, as is it.

On VFP 5 you can set a prg's class to an UDF,
on VFP 8 and 9 you cannot.

VFP is not a level 1 language, like C,
then the VFPT wants to protect you from yourself,
putting constraints and blocks of operations
that can lead to side effects,
and which you do not have the skills to manage them.

>>>Hi James,
>>>
>>>Well then, why is this not in the documentation?! It is very important to know this, isn't it. I can say I'm a really experienced vfp developer, doing vfp since 1990. But this has never been told or explained to me, nowhere, not in the docs, not in the Hackers guide. 'By-design' may be what has been told to you, but to me that sounds like a rationalisation, to hide the real reason: a design flaw or simply a blind spot for this when implementing it, in both cases a flaw they somehow didn't want to repair.
>>>
>>>Re-using the cached version of a previously instantiated object is smart enough, but of course that should not imply the re-use of any initial values.
>>>
>>>>Peter --
>>>>
>>
>>It is not a language behaviour,
>>it is an optimization.
>>
>>Every optimization pays a price!
>>
>>>>By design.
>>>>
>>>>FoxPro does neat things with caching classes you have referenced so it does not have to re-create them from
>>>>scratch every time you use them.
>>>>
>>>>This is the same problem experienced in VCX-based classes where the property value is created with an '=',
>>>>which is executed the first time the class is created only.
>>>>
>>>>>Hi all,
>>>>>
>>>>>In the code hereunder the nStart property is set to the value of seconds() at the moment of creating the object. However, if I create another instance of the object (while the first is still active) the property does not get the value of seconds() of the moment of creation, but appears to be totally equal to the property of the first instance!
>>>>>
>>>>>I imagine I can get around this by redeclaring it in the Init(). But why is this happening? Another bug or 'just' a quirck? Or is it by-design??
>>>>>
>>>>>
DEFINE CLASS cusLogFileHandler AS custom
>>>>>	
>>>>>	nHandle    = 0
>>>>>	nErrors    = 0
>>>>>	dStart     = date()		&& start date - required for calculation of elapsed time
>>>>>	nStart     = seconds()
>>>>>	cFileName  = ""
>>>>>
>>>>>	PROCEDURE init( tcFileName, tlNew )
>>>>>		local lcWhat
>>>>>
>>>>>		with this
>>>>>			*
>>>>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform