Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
&& within string gives error
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00601634
Message ID:
00602850
Vues:
34
>>>Are you using it within strings? If yes, would you like to describe why?
>>
>>How about
>>
>>
>>cFld1= "DateFld"
>>cFld2= "TimeFld"
>>
>>cSQL= "SELECT * FROM MyTable ORDER BY &cFld1, &cFld2"
>>&cSQL
>>
>>
>>Although I know most people wouldnt not write it this way, some might,
>>Looks neater then
>>
>>cSQL= "SELECT * FROM MyTable ORDER BY " + m.cFld1 + "," + m.cFld2
>>
>>
>>but I still prefer the second way.
>
>Yes, I understand that. I meant within a string such as a label as in this:
>
>
>LOCAL lcString,lcAddToString
>lcString=''
>lcAddToString='this is to be added'
>lcString='This is my string &lcAddToString which ends here.'
>
>
>So, just to define a string, such as lcString in the last line, what would be the used to use the macro substition when we can easily just do:
>
>
>LOCAL lcString,lcAddToString
>lcString=''
>lcAddToString='this is to be added'
>lcString='This is my string '+lcAddToString+' which ends here.'
>
>
>This is what my wish is all about.

I understand, I dont know why macro substitution was ever allowed inside a string, I think it just leads to messy code. And I personally dont take advantage of what I guage to be a bug.
I was simply showing an example where someone may have taken advantage of it, and hence their code would break if the 'feature' was removed / fixed.
I believe that was where this started with someone saying that fixing it might lead to backward compatibility problems.
By all means fix it with respect to &&, so that && inside a string is read as a part of the string, and not a comment, I dont see how that could cause any problems in peoples code.
But cant remove the & macro sub. from strings as people may have taken advantage of it.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform