Board index » delphi » What's the Namingscheme in a ...TLB.PAS

What's the Namingscheme in a ...TLB.PAS

Quote
In article <34BD4B4C.A6DAEAE2@Botany_Bay.Con>, Raj Gabrielse wrote:
> But I
> also see a lot of other declarations using names that also exist in
> Delphi, like Application.

Certain language elements, like Property, are reserved words.  Application
is merely a variable, and while duplicating it is troublesome, it's not
prohibited.

Quote
> So, I'd like to go over the code and change each name that is exactly
> the same as the name of the type from which it's derived to something to
> distinguish the both of'm.

OLE objects are uniquely identified by the GUIDS (those long hex strings).
 The names are just handy nicknames.  You can safely change the nickname
without causing problems.  However I think it's a bad practice. When MS
releases Word 2001, you'll import a new typelib, and have to change all
the identifiers all over again.

Application is the chief source of conflicting identifiers, and I seldom
refer to it in my Delphi code.  It's easy enough to change those few
references to Forms.Application, which is unique and eliminates the
problem.

 

Re:What's the Namingscheme in a ...TLB.PAS


Hi all,

In the code, resulting after a typelibrary import are almost always
comments inserted, stating that declaration so and so, or property this
or that has been renamed due to conflicts with reserved words. But I
also see a lot of other declarations using names that also exist in
Delphi, like Application.

An earlier posting suggested to change the name of these type
declarations to avoid conflict with the application object in Delphi.
But can you safely change names of declarations?

I've tried to get a mental picture on the how things fit together by
going over the various declarations and noticed that it was very
difficult to keep track of which is which, there seem to be number of
occurances where the property or class has the exact same name as the
type from which it is derived.

Since I've seen in the inserted comments that Delphi renames
declarations by adding or prefixing an underscore I am wondering if I
can do this myself too. Changing names in declalations, to better
reflect what the identifier's type is I mean.

To what extent can I do this safely,  like, I've seen a lot of interface
declarations start with an i, but in the ...TLB.pas, this is not
consequently done, so sometimes the interface declaration looks like a
regular variable definition or a dispinterface is not prefixed with a d,
thus contributing to my confusion when trying to understand how things
fit together.
So, I'd like to go over the code and change each name that is exactly
the same as the name of the type from which it's derived to something to
distinguish the both of'm.

TIA
Raj Gabrielse
=(email address is bogus, reply_to contains 'almost' correct address)=

Re:What's the Namingscheme in a ...TLB.PAS


Hello Scott,

Quote
> You can safely change the nickname without causing problems.  

After some further reading I learned that just about everything is
mapped thru dispid's. Most of this still don't 'stick', but I've no
doubt that my first real project will soon take care of that ;)

Quote
> However I think it's a bad practice. When MS releases Word 2001,
> you'll import a new typelib, and have to change all the identifiers
> all over again.

Maybe so, OTOH, for me it's the best way to explore areas where I
have no or little experience...and as you said...

Quote
> Application is the chief source of conflicting identifiers

Even though this one is easily avoided, there's always that *one* ...
besides, I just can't keep track of all these 'double identities'
and who knows, maybe when W2001 arrives, there's a D2010 that is
intelligent enough to maintain a 'translation' log so each re-import
will be automagically 'corrected' :)

Thanks for clarifying though, much apppreciated

Raj Gabrielse

Other Threads