[fpc-pascal] dot within unit file name

Matt Emson memsom at interalpha.co.uk
Fri Jan 18 13:43:31 CET 2008


Michael Van Canneyt wrote:
> On Fri, 18 Jan 2008, Matt Emson wrote:
>
>   
>
> What is the difference ? 
> The second one saves on typing, which is a plus in my book ?
>   
Right.. confusion over verbosity. Given two units called 
"Constants.pas", which one is the correct unit? Given a unit called 
"Utils.pas" and one called "ExtraDefs.pas", both of which contain 
different implementations of the type TSocket, which is the correct unit 
to use?

>  
>   
>> File names should have nothing to do with Namespaces too.
>>
>> I'd also love:
>>
>> unit Blah;
>> Namespace MyAPI.Blah;
>>     
>
> And how will you know which namespace is in what unit (or file) ?
>   

Turning it on its head - file names should have nothing to do with unit 
names. The unit lives in a namespace, The namespace directive gives the 
path to the unit. so it would be:

unit Blah;
namespace MyAPI

and

uses MyAPI.Blah;



> You then need a second structure mapping namespaces on filenames, making it
> slower, bulkier and error prone. The cure is worse than the disease, IMHO

Nope.. see above.

Do you have a problem with partial classes? Also called "Categories" in 
Objective C.



More information about the fpc-pascal mailing list