PDA

View Full Version : Namespaces a reality in PPL 1.1


kornalius
10-26-2006, 03:19 AM
To solve*some complex situations in PPL where the same procedure names and variables. Right now, when two forms are created in PPL with the same control names*and used within the same project it causes problems. In version 1.1 it won't be anymore.*It will probably appear in beta form in 1.06 so it can be stable and usable by 1.1.</p><pre>#namespace mylib</pre><pre>* global(a$);</pre><pre>* proc test
*** a$ = 10;
*** ShowMessage(&quot;MyLib.Test&quot;);
* end;</pre><pre>#endnamespace</pre><pre>#namespace mylib2</pre><pre>* global(a$);</pre><pre>* proc test
*** a$ = 20;
*** ShowMessage(&quot;MyLib2.Test&quot;);
* end;</pre><pre>#endnamespace</pre><pre>proc main</pre><pre>* ::mylib test;
* ::mylib2 test;</pre><pre>* ShowMessage(::mylib a$ + &quot;,&quot; + ::mylib2 a$);* // Should display 10,20</pre><pre>end;</pre>

Let me know what you think.</p>

Paul Fielder
10-26-2006, 04:20 AM
Sound like a fantastic way of solving the problem of having to manualy change all the control references

matteo.m
10-26-2006, 06:56 AM
its fantastic! bravo

Solonn
10-26-2006, 07:43 AM
Seems pretty good.

kornalius
10-26-2006, 07:03 PM
Hi, here is an update on namespaces. The following code works perfectly.</p><pre>#namespace space1
proc test
* global(a$);
* a$ = 10;
* ShowMessage(&quot;Space1.Test&quot;);
end;
#endnamespace</pre><pre>#namespace space2
proc test
* global(a$);
* a$ += 20;
* ShowMessage(&quot;Space2.Test&quot;);
end;
#endnamespace</pre><pre>proc main
* a$ = 11;
* ::space1 test;
* ::space2 test;
* ShowMessage(::space1 a$ + &quot;,&quot; + (::space2 a$ + a$));
end;</pre>

We still haven't worked on the object-oriented part. It might come with time.</p>

Keep in mind that namespaces in 1.06 will be in beta stage.</p>