Hi!
On 26.07.2010 15:44, Graeme Geldenhuys wrote:
uses rc.foo, my.foo, my; // there is a unit my
...
begin
foo.a; // error, which foo?
my.foo.a; // is that unit my, record foo.a OR unit my.foo ?
Good point, I haven't thought that far. I only worked though of the uses
clause. Maybe when referencing a namespace we need a different syntax?
Something that distinguishes between a<unit name>.<var or record>
reference and a<namespace>.<unit name> reference.
I'm not sure what will fit nicely in the Object Pascal language. Generics
already uses the< and> characters. The _ is not allowed as the starting
character of a unit name, so maybe that could be used? Or maybe the #
character?
Are you sure that "_" is not allowed at the beginning of a unit name?
=== source start ===
unit _test;
interface
implementation
end.
=== source end ===
Compiles without problems.
eg:
uses
rc.foo, my.foo, my;
...
begin
foo.a; // is the<unitname>.<var or record> syntax
_my.foo.a; // is<namespace>.<unit name>.<var or record> syntax.
...not sure if _ should be used in the uses clause as well for consistency.
Currently a '.' (dotted) unit name is not allowed in the uses clauses, so
FPC could know that a 'rc.foo' means<namespace>.<unit>. But consistent
syntax is probably better, so the uses clause will change to.
uses
_rc.foo, _my.foo, my;
Second suggestion is changing the _ character to a # character, but then
again, that conflicts with a hex char notation, so is probably not a good idea.
What about using ":" as a starting character for namespaces? It should
be less problematic than "#" (even when used in type/variable/parameter
declarations).
Other possibilities are "!", "?", "~", "%", "|", "\" and """ as they
aren't used yet as far as I'm aware of... (please correct me here if
necessary ^^)
Regards,
Sven
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal