Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 * before identifier
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Naveg




PostPosted: 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
Sponsor
sponsor
Delos




PostPosted: 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




PostPosted: Sat Mar 12, 2005 4:36 pm   Post subject: (No subject)

that only happens if you export?
Delos




PostPosted: 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...
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: