Re: True Name Spaces, when?
- From: L <L@xxxxxxxx>
- Date: Mon, 18 Feb 2008 17:19:42 -0700
Marco van de Voort wrote:
On 2008-02-17, L <L@xxxxxxxx> wrote:The one thing I notice with turbopascal/delphi programmers is they don't even make use of dot notation and instead they name their procedures and functions uniquely per each unit.
Well, I think you see that wrongly. At least how I feel is that while I
avoid name clashes for certain much used identifiers, I don't automatically
prefix every function with e.g. an unit prefix, and I don't know any people
that do.
This defeats the purpose of unit namespaces altogether if one is avoiding
using unit.dot.notation. Example: the only time people use
unit.dot.notation in delphi code is if something is conflicting such as
system.lowercase vs sysutils.lowercase.
That's exactly what I meant. It is less worse to prefix a few very common
identifiers that to prefix them.
IOW, mandatory prefixing is worse than the current situation.
Rather instead of all the class/object bloat I see, many times people
could be making use of unit aliases.
The overhead of a class is a few bytes. The overhead of an object (TP style)
close to none. I hardly call that bloat.
I was not speaking of EXE bloat.
You always assume I come from a KOL bias view.. ;-)
I was speaking of this utter crap:
try
Sysutils:= TSysutils.Create;
finally
SysUtils.Free;
SysUtils:= nil;
end;
Rather, Modules.. ala modula or component pascal, or turbopascal.. are better solution. Because in some cases we do not need a class for general purpose public functions such as StringReplace() and Pos().
You know this...
I am patronizing you...
What I meant was that sometimes people abuse Delphi's class system because they do not have namespaces or unti aliases!
For example in Powtils right now, we have the problem of:
Format()
being inside the sysutils unit and the pwmain unit...
So I could change it to something ugly like:
WebFormat()
Which is silly... Instead this is better solution:
uses
sysutils,
pwmain as 'web';
begin
web.out();
web.format();
format() // calls sysutils one
// no mandatory required.
end.
Then if I update my web program to use the Powtils DLL:
uses
sysutils,
dynpwmain as 'web'; // dll version of PWMAIN
begin
web.out();
web.format(); // no need to change pwmain to dynpwmain
format() // calls sysutils one
end.
.
- Follow-Ups:
- Re: True Name Spaces, when?
- From: Marco van de Voort
- Re: True Name Spaces, when?
- From: L
- Re: True Name Spaces, when?
- References:
- True Name Spaces, when?
- From: Thomas Miller
- Re: True Name Spaces, when?
- From: Hans-Peter Diettrich
- Re: True Name Spaces, when?
- From: L
- Re: True Name Spaces, when?
- From: Marco van de Voort
- True Name Spaces, when?
- Prev by Date: Re: new computer: any reason not to go for 64 bits?
- Next by Date: Re: True Name Spaces, when?
- Previous by thread: Re: True Name Spaces, when?
- Next by thread: Re: True Name Spaces, when?
- Index(es):