Modules: Add "Main::" To Access Main Code Namespace

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Tristano
Enthusiast
Enthusiast
Posts: 190
Joined: Thu Nov 26, 2015 6:52 pm
Location: Italy
Contact:

Modules: Add "Main::" To Access Main Code Namespace

Post by Tristano »

I don't know if this is possible, but it would be nice if Modules could access variables, procedures, etc., from the main code via something like "Main::" — ie: make "Main::" act like if the main code was an implicit module.

This would allow to exceptionally access some vars or procedures declared in main code, meanwhile still avoiding namespace conflicts. It could make life easier in many situations, and it wouldn't break backward compatibility (except for cases where "Main" was declared as a module name).

Is this something that could be added to PureBasic?
The PureBASIC Archives: FOSS Resources:
User avatar
luis
Addict
Addict
Posts: 3876
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Modules: Add "Main::" To Access Main Code Namespace

Post by luis »

Hi, already requested and discussed in more than one thread, I don't think it's gonna happen.

http://www.purebasic.fr/english/viewtop ... =3&t=56425
"Have you tried turning it off and on again ?"
A little PureBasic review
User avatar
Tristano
Enthusiast
Enthusiast
Posts: 190
Joined: Thu Nov 26, 2015 6:52 pm
Location: Italy
Contact:

Re: Modules: Add "Main::" To Access Main Code Namespace

Post by Tristano »

Thanks luis ... sorry for the duplicate, I wasn't aware of the post you linked — as the forums grow bigger and bigger, it's getting more difficoult to find resources and topics because there is no system in place to nicely categorize topics as "feature reuests", "bugs", etc., with some official status (eg: "accepted", "rejected", "solved", or the like), or to associate threads and posts to specific versions of PB.

I'm reading the post you linked and the discussion and motives why it will not happen. I find it very useful, also because I'm yet to test the edge-limits of modules interactions.
The PureBASIC Archives: FOSS Resources:
Post Reply