Information générale
Catégorie:
Codage, syntaxe et commandes
>>Other than that this is right from the help in VFP6
>>
>>"To reference a property in an object that has the same name as an open table, preface the property name with the M. qualifier. For example:
>>
>>USE customer
>>SCATTER NAME customer
>>
>>? customer.company && Returns the table value
>>? M.customer.company && Returns the object property value"
>
>That's not the problem. It will fail if you have an object (variable) like the alias and no property is named like a field. Different, but it will fail. This is understood.
>
>It goes explicit for properties that are arrays and noted with braces or brackets. Or, for the braces, methods but this is the same notation. Properties or not the problem its only about stuff ending in ( or [. The notation with braces and brackets changes the way VFP looks stuff up. At least with non property array vs field
On the aside, one of the things that makes me cringe is when I see parenthesis rather than square bracket used when accessing an array element. Not only could it be ambiguous to a human reading the code, but I'd seen at least one situation where the *same* line of code could get interpreted as an array reference or a function - depending on the context at the time when that line of code was run.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement