[fpc-pascal] dot within unit file name

Bee bisma at brawijaya.ac.id
Fri Jan 18 14:06:57 CET 2008


> I think if sb would waste time on it, and the patch is good quality it might
> be added. Not because it is a good feature (afaik it is not), but out of
> Delphi compat. 

Good or bad is relative. FPC is about development tool, each user has 
he's own good or bad way of programming. The more features it has, the 
better for the users. As I said, feature is feature, users may use it or 
not, it's absolutely up to him. So, it's all about Delphi compatibility. :)

> Because how do you determine the difference
> b.a.c.d (field d of class c in unit b.a)
> and 
> b.a.c.d (field d of class c in class a in unit b)

I know nothing about compiler. But in my simple way of thinking, the 
compiler should "remember" unit list.

- If "b.a.c" is declared within the uses clause then threat each "b.a.c" 
as a unit.
- If then in the unit body there is a "b" class/record that has an "a" 
property/subrecord that has a "c" record variable then compiler should 
raise an "ambiguous identifier" error.
- If compiler finds "b.a.d" then it raises "unknown identifier" error 
since there's no "b.a.d" unit is declared within uses clause.
- If there is no "b.a.c" in uses clause than threat "b" as an identifier.

Of course, this logic is far too simplified. :-D

> What does Delphi/win32 really do with that? Does it more than simply
> ignoring parts of the name, and if so, what exactly? Could you make an
> overview of this feature?

I don't know how Delphi handle this internally. AFAIK, Delphi threats 
"b.a.c" as a unit if it's declared in the uses clause. Actually it is 
like the usual way Delphi threat units, but allows dot in the unit's 
file name. You can't use "a.c" and hope it will refers to "b". Use it 
all or use none. CMIIW. I didn't touch my Delphi in the last 6 months, I 
can be wrong or forget the detail of this feature. Somebody please 
confirm this.

> And what is the use in your view?

I don't need (yet) namespace or whatever that is as in Delphi 2007, I 
just want to use dot in my unit's file name. Second, for Delphi 
compatibility. :)

-Bee-

has Bee.ography at:
http://beeography.wordpress.com



More information about the fpc-pascal mailing list