Page 1 of 1

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

Posted: Mon Aug 14, 2017 10:18 am
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?

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

Posted: Mon Aug 14, 2017 11:38 am
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

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

Posted: Tue Aug 15, 2017 2:50 pm
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.