Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Pass param by reference or private variable?
Message
De
03/10/2019 18:37:23
 
 
À
03/10/2019 10:11:34
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01671293
Message ID:
01671383
Vues:
76
>>>
>>>set path to "..\underscore" addititive
>>>oEmpty = CREATEOBJECT("empty")
>>>with _( m.oEmpty )
>>>   .return_success = .T.
>>>   .string1 = "abc"
>>>   .string2 = 123
>>>endwith
>>>
>>
>>Thank you for your input. But why "strongly"? And what is the benefit of getting rid of addproperty?
>
>Because I agree with him :). And you aren't getting rid of it, it's just delegated into the background, where the underscore function (OK, the name isn't its strong point, everything else is) deals with it. The code above looks much cleaner than having each name and value wrapped in quotes and a function call.

I agree that "normal" property assign looks nicer and is easier to understand, and as long as it is not overused to be the backbone of a fwk (inserting the overhead nearly everywhere) it is an intelligent and elegant approach.

But the specific "with" functionality has bitten a few stalwarts - me included. I have "only" witnessed type changes of return value not expected on source - others cited other reasons to be wary of "with .. endwith"
Local var to the rescue (and still prettier IMO)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform