Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using == vs =
Message
De
14/11/2015 06:24:02
 
 
À
14/11/2015 06:20:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01627149
Message ID:
01627420
Vues:
49
>>>>>>>>>Is there any gotcha using == as a standard?
>>>>>>>
>>>>>>>I have seen issues comparing fields of unequal length, where == always fails.
>>>>>>
>>>>>>Why are they issues?
>>>>>>Shouldn't it be failing?
>>>>>>
>>>>>>"John" does not equal "Johnny"
>>>>>>
>>>>>>The = operator has caused more bugs for me than any single feature in VFP (had one last week.)
>>>>>>
>>>>>>Why anyone would have a language state that "A" = "" is beyond comprehension.
>>>>>
>>>>>This is something that came from dBase times, and once you learn how it works, you know how and where you can use it.
>>>>>
>>>>>You must remember that when dBase was born, no SQL syntax or like() function existed at that time, so this kind of comparisons where an adventadge, and not a problem. Even today they are used for variuos user cases.
>>>>
>>>>To me, the key point is that originally, dBase was primarily for interactive use and in that setting, SET EXACT makes perfect sense.
>>>>
>>>>Tamar
>>>
>>>I'm generally OK with it.
>>>
>>>I mentally transform "=" into "begins with."
>>>
>>>My issue is with "A" = "".
>>>
>>>Something cannot begin with nothing. It has to begin with something.
>>
>>put attention on this logic
>>
>>"ABC"
>>it begin with "A" because "ABC" == "A"+"BC"
>>then definition of begin is "every left string that added ( concatenation ) with a right string return the original string"
>>then
>>"ABC" == "" + "ABC"
>>"" == "" + ""
>>and !
>>"" = "" + ""
>>
>
>That's interesting logic, Fabio and it probably is what the people who wrote the language had in mind.
>However when someone asks "What does 'ABC' begin with?", I will continue to answer "A", not "nothing."

I can understand.

You can answer to this:
"What does '' begin with?"
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform