Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a sub-library in the "uses" clause?

Tags:

delphi

Back there when I use Delphi 2006 it was:

 uses System, SysUtils, StrUtils, Windows, Dialogs, WinApi;

But recently we can use:

 uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics;

How this change works? Does they separated the System.pas into System.*.pas or did they created a new clause for separating function by types in a single library?

How do I modify my old libraries to work like this? I want to do make something like: MyLib.Logic, MyLib.Arrays, MyLib.NetWork etc.

like image 507
NaN Avatar asked Dec 27 '22 06:12

NaN


1 Answers

Just open your old files in the ide, and in the project manager rename the unit. It'll automatically change the unit name inside the file.

After that, open and recompile your old projects to make sure that you refer to the right unit names.

The only advantage of these dots over something like an underscore seems to be that you can get a list of matching "sublibraries" in code completion.

The part before any dots shouldn't be called a "namespace", because it doesn't work like one.

like image 52
Wouter van Nifterick Avatar answered Jan 18 '23 00:01

Wouter van Nifterick