alternative aliases [Re: [fpc-devel] Re: [fpc-pascal] Re: Ideas for namespace implementation]
Alexander Klenin
klenin at gmail.com
Tue Jul 27 11:20:08 CEST 2010
On Tue, Jul 27, 2010 at 02:27, Martin <fpc at mfriebe.de> wrote:
> uses Foo in 'lcl' alias 'FooLCL', Foo in 'RTL' alias 'FooRTL'
I think this is a reasonable idea, with the following caveats:
1) I think both aliases and namespaces should be identifiers, not strings
(i.e. quotes are unnecessary distraction).
2) I think that namespace-like syntax is preferable, i.e.
"LCL.Foo", not "Foo in LCL"., additionally, I do think it would do no harm
to let programmer use "namespaced" unit without alias.
3) Finally, after a slight variation of syntax to avoid extra 'alias' keyword,
we arrive at the following proposed syntax:
uses
FooLCL=LCL.Foo, RTL.Foo;
begin
FooLCL.proc();
RTL.Foo.proc();
end.
which is quite similar to already existing 'alias' feature for types:
type
TFooLCL=LCLUnit.TFoo;
begin
TFooLCL.Create();
RTLUnit.TFoo.Create();
end.
--
Alexander S. Klenin
More information about the fpc-devel
mailing list