Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Check which procedure or routine called Access method
Message
De
04/05/2021 03:40:22
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01679909
Message ID:
01680120
Vues:
56
>A follow-up question please. So far, my test shows that program(program(-1)-1) will give what I am looking for.
>Since I write this value to a log file, I want to be sure that it is always a string, not a numeric value. Can you think of a case where program(program(-1)-1) will give a numeric value?

Saw that you already got great responses ;-)
Danger only rises when the levels subtracted are greater than actual stack depth, as *any* negative number as parameter will return numeric.
In practice you are probably safe to chain 2 or even 3 previous levels into single log line unless you are in actual start code.
Trying for more levels default approach should go to astackinfo with a guard, unless specific reason speaks against it.
Of course you could always guard with
program(max(0, program(-1)-wantedlevell)
calls against weird situations, but JR hints at other solution perhaps easier to grok in 6 months.
In this case speed freak in me does neither ;-)

regards
thomas
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform