Hi
I have seen some Purebasic code on the ChilKat Software website that uses "::" (double colons). In other languages I have seen this used for a scope resolution operator and it looks like that in the Purebasic code but I cannot find any documentation about the use of double colons in Purebasic. Does anyone know where I can find some information about the use of the double colon in reference to Purebasic?
Thanks,
Simon
Double Colon use in Purebasic
Double Colon use in Purebasic
Simon White
dCipher Computing
dCipher Computing
Re: Double Colon use in Purebasic
True, it should be mentioned in the general syntax rules. But '::' is shown in modules.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
- netmaestro
- PureBasic Bullfrog
- Posts: 8433
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Double Colon use in Purebasic
With modules all of the procedures and vars specific to the module are only visible within the module. Basically, anywhere else you might be within the code, be it the main code or inside a procedure, module assets are "out of scope" to you. This is of course by design. But you need to use what's in modules from time to time and so there are two ways to do that from foreign codeparts:
1) UseModule Stuff This will make assets from the module "Stuff" visible to your current location without further qualification.
2) You can tap the module assets without UseModule by qualifying their names with the module name followed by the :: symbol. Stuff::<asset name> allows this.
Also note that this addition occasioned some changes in PB syntax with regard to colons. For example, this used to be allowed:
DataSection
label1: IncludeBinary "Somefile"
EndDataSection
but now it will generate a syntax error. It was always a shortcut that broke basic syntax rules anyway, it just took the new :: addition turning up for it to come under the piercing glare of Fred's evil eye, where it did not survive for long.
1) UseModule Stuff This will make assets from the module "Stuff" visible to your current location without further qualification.
2) You can tap the module assets without UseModule by qualifying their names with the module name followed by the :: symbol. Stuff::<asset name> allows this.
Also note that this addition occasioned some changes in PB syntax with regard to colons. For example, this used to be allowed:
DataSection
label1: IncludeBinary "Somefile"
EndDataSection
but now it will generate a syntax error. It was always a shortcut that broke basic syntax rules anyway, it just took the new :: addition turning up for it to come under the piercing glare of Fred's evil eye, where it did not survive for long.
BERESHEIT