Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Strange behavior of Select
Message
 
 
À
27/11/2012 06:15:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01558144
Message ID:
01558156
Vues:
71
Unfortunately, yes. It makes code harder to read and VFP made it even worse. Before VFP MyUdf() would generate an error so you have to call it as =MyUdf() which clearly shows that it's a function.

>What I didn't realize was that the missing space in 3 is ignored, so it's legal to have a command that looks like a function.
>
>>You shouldn't believe everything you hear. SELECT() function never changes a work area.
>>
>>? SELECT (myWorkArea)    && Function
>>SELECT (myWorkArea)    && Command
>>SELECT(myWorkArea)    && Command
>>
>>
>>>I was just notified of a very strange behavior of the Select command and the Select() function, by Maharastra Kolhapur on Foxite. What he told me, and which I didn't know, was that Select() also performs an implicit Select command "behind the scene" when you supply a work area that is actually used. And even "worse", VFP makes no distinction between Select(myWorkArea) and Select (myWorkArea), note the space, they both are treated as Functions!
>>>
>>>Here is a small, slightly modified, excerpt from my message on Foxite. Please read carefully, the impact may be bigger than you immediately think.
>>>myWorkArea = 'myTable' && myTable is already used in another work area
>>>1. ?Select(myWorkArea) && Function
>>>2. ?Select (myWorkArea) && Function or Command? Looks like a command but is treated as a function. 
>>>3. Select (myWorkArea) && Function or Command? Looks like a command but is treated as a function. 
>>>
>>>Note that the only difference between 1 and 2 is the space. I would expect an error on 2.
>>>And that the only difference between 2 and 3 is the question mark.
>>>Since we have the "option 3", maybe it's a good thing that Select() also performs an implicit Select command?
>>>
>>>I am really grateful for your discovery, which I will keep in mind. Luckily we have the debugger.
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform