<div dir="ltr">On Tue, Oct 29, 2013 at 3:50 PM, Marcos Douglas <span dir="ltr"><<a href="mailto:md@delfire.net" target="_blank">md@delfire.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="im">
</div>Yes, works... but the language allow hide the unit name and nobody<br>
uses unit name as an identifier in 99% of cases, Am I right? So,<br>
problems can be happen.<br>
<br></blockquote><div>From my experience I'd say no. <br>I actually had to use the explicit unit name in probably 2% of the code.<br></div><div>Back
from Delphi days: some of the functions between WinAPI (windows.pas)
and VCL (sysutils.pas) are actually using the same name.<br></div><div>So specifying the exact unit name is required to get the code compiled properly.<br></div><div>There were some collisions on MacOSX (carbon) type names with LCL type names.<br>
</div><div>So it's not that unrare thing to happen.<br><br></div><div>And as you've given example above. If I'm writing a unit
that uses two separate units with the same identifiers reused, I'd
recommend to specify a unit name explicitly. (Just not to rely on a compiler doing it right for you).<br></div><div>uses<br></div><div> windows, graphics;<br><br></div><div>var<br></div><div> wb : Windows.TBitmap;<br></div>
<div> gb : Graphics.TBitmap.<br><br></div><div>or <br><br><div>uses<br></div> windows, graphics;<br><br></div><div>type // declare once, use everywhere<br></div><div> TWindowsBitmap = Windows.TBitmap;<br></div><div> TGraphicsBitmap = Graphics.TBitmap;<br>
</div><br><br><div>var<br></div><div> wb : TWindowsBitmap;<br></div> gb : TGraphicsBitmap.<br><br>thanks,<br>Dmitry </div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 29, 2013 at 3:51 PM, Dmitry Boyarintsev <span dir="ltr"><<a href="mailto:skalogryz.lists@gmail.com" target="_blank">skalogryz.lists@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="im">On Tue, Oct 29, 2013 at 8:02 AM, Marcos Douglas <span dir="ltr"><<a href="mailto:md@delfire.net" target="_blank">md@delfire.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
</div>You didn't understand.<br>
The namespace we talk about is like a "dinamic namespace". The<br>
programmer can choose which "names" he will use in your projects when<br>
these projects are using third-party frameworks.<br>
In Java, eg, you can change the path of frameworks, changing the<br>
"namespace", without change the original sources.<br></blockquote></div><div>I thought I did, but named it differently.<br></div><div>Isn't what you're trying to explain is suggestion #3 at this page? <a href="http://wiki.freepascal.org/Namespaces" target="_blank">http://wiki.freepascal.org/Namespaces</a><br>
<br></div><div>Instead of modifying the code (i.e. by switching to namespaces)<br></div><div>You would like to give then compiler a hint what unit should be used when compiling a unit.<br><br></div><div>In other words, you'd like to unit-specific -Fu, that should override the project -Fu.<br>
</div><div>Right? or am I still misunderstanding.<br></div></div><br></div><div class="gmail_extra">thanks,<br>Dmitry<br></div></div>
</blockquote></div><br></div>