Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Macro and evaluate() fire a error with CR on Literals
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
00973008
Message ID:
00973153
Vues:
13
>>Are you sure you aren't thinking of EXECSCRIPT()? EVALUATE() is only supposed to operate on a single expression. Macro Substitution isn't supposed to work with more than one line, either.
>
>Hi Garrett,
>
>Of course!
>But VFPT don't trap a multiline CR or NL, they have trapped a innoffensive literal CR or NL,
>it is a character, not a command line separator.
>The bug it is still present on VFP9.
>
>I try another example:
>
>CLEAR
>ON ERROR ?? MESSAGE()
>
>? "Expected : 6    Observed VFP8 : 6 VFP9 : Error"
>? EVALUATE("printLenString([3+5"+CHR(13)+"+2])")
>
>? "Expected : 6    Observed VFP8 and VFP9 : Error"
>? EVALUATE("printLenString([3+5"+CHR(10)+"+2])")
>
>? "Expexted : Error Observed VFP8 and VFP9 : Cut the code"
>? EVALUATE("printLenString([A])"+CHR(13)+"+printLenString([A])")
>
>? "Expexted : Error Observed VFP8 and VFP9 : Cut the code"
>? EVALUATE("printLenString([A])"+CHR(10)+"+printLenString([A])")
>
>? "Expexted : Error Observed VFP8 and VFP9 : Cut the code"
>? EVALUATE("printLenString([A])"+CHR(0)+"+printLenString([A])")
>
>ON ERROR
>
>PROCEDURE printLenString(s)
>RETURN LEN(s)
>
Frank's got it right here, I think: if you look at it as the actual string you're trying to execute, it makes sense.
printLenString([3+5
+2])
should fail.
printLenString([A])
printLenString([A])
should not. Since EVALUATE() is only supposed to evaluate a single expression, and, as Aleksey says, the end of the line is treated as the end of the string literal, VFP9 is showing the correct behavior.
My blog
My consulting page
My home page

Member of the Trim Your Auto-Quote Campaign!
What's another word for thesaurus?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform