Posted: Sat Mar 12, 2005 12:52 pm Post subject: * before identifier
I've seen a * used before an identifier before while reading other people's code. like...var *person:string. What does this do?
Sponsor Sponsor
Delos
Posted: Sat Mar 12, 2005 4:15 pm Post subject: (No subject)
The * is the short form for "pervasive". This means that the variable is...umm..universal, and needn't be imported into an modules or other such containers within a proggie.
Try it:
code:
var superVar : string := "Muwahahaha"
module test
export main
proc main
put superVar
end main
end test
test.main
Try run that. It crashes. Now add a "*" infront of 'superVar'. Run again. Magic.
This becomes more useful when you need to programme things that get really complicated and require a large number of classes and modules and other such object-type thingies.
Naveg
Posted: Sat Mar 12, 2005 4:36 pm Post subject: (No subject)
that only happens if you export?
Delos
Posted: Sun Mar 13, 2005 12:42 am Post subject: (No subject)
Not the exporting part...add the line
code:
import superVar
to the beginning of the module and leave the variable as non-pervasive. There you go...manual importation of req'd vars. Once again, the uses may not seem apparent...