Information générale
Catégorie:
Codage, syntaxe et commandes
>>>Oh. Since they're not local, are they public?
>>
>>No, they are not public. They are a weird kind of animal! They behave as private /public variables for all called func/proc/methods. But they are released as soon as the func where they ar declared is finished.
>>
>How is this different from the behaviour of PRIVATE variables?
Did you try the short code sample from my previous message? It clearly shows the difference.
So, PRIVATE only hides a variable that already exists at a higher level. Here's what happens whenever you use a variable without any declaration:
- The variable name is looked up at any higher level
- If found, the same variable is used. If not found, a new variable is created.
- If a new variable was created, then it released at the end of the proc.
Here's what happens when you use a PRIVATE variable:
- The variable is created and used.
- The same variable is released at the end of the proc.
This means that any used-but-not-declared variable may modify some variable with the same name from a higher level. This may be desired some times, but it's dnagerous and I advise against such use.
Vlad
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement