Re: Global Const vs Public Const
- From: "Ralph" <nt_consulting64@xxxxxxxxx>
- Date: Tue, 12 Sep 2006 08:23:02 -0500
"Bob Butler" <tiredofit@xxxxxxxxxxx> wrote in message
news:u1RZTnm1GHA.1548@xxxxxxxxxxxxxxxxxxxxxxx
"Ralph" <nt_consulting64@xxxxxxxxx> wrote in messagedepending
news:5dednTBfpcOZt5vYnZ2dnUVZ_rmdnZ2d@xxxxxxxxxxxx
"Michael C" <nospam@xxxxxxxxxx> wrote in message
news:%234z3GVf1GHA.1132@xxxxxxxxxxxxxxxxxxxxxxx
"Bob Butler" <tiredofit@xxxxxxxxxxx> wrote in message
news:%23GNRjSd1GHA.1256@xxxxxxxxxxxxxxxxxxxxxxx
At least as far as development tools go. The fact that MS is
leading in a given direction is no reason to follow. Deprecating
Global in favor of Public was a mistake IMO
Hardly, Global is the wrong term. Global means world wide as in
accessible to everything everywhere. Public just indicates that it
is exposed outside the class that holds it.
Michael
I perhaps I shouldn't attempt to speak for Bob, but I believe he was
not referring to the elimination of Global from Forms/Classes. Public
in these objects means -> declared as part of the default or Public
Interface. There are no 'Global' or static members in VB classes. The
syntax checker will not allow 'Global' to be declared in these items.
That actually makes some sense.
He was referring to the 'dual' nature of Public and Global in bas
modules, where for no apparent reason they mean exactly the same
thing, i.e., the syntax checker will accept either. It would have
been clearer if MS had left 'Global', and disallowed 'Public' in bas
modules.
Global wasn't eliminated from forms and classes, it was only ever valid in
BAS modules and always meant 'global to the project'. The meaning and use
has not changed. When Public was added it was given two meanings
on where it was used; part of the public interface of the creatable objectwas
for forms and classes or 'global to the project' in a BAS module. There
no need to give Public this dual meaning since the Global keyword alreadyan
existed and was handling the one case quite nicely and it only introduced
ambiguity when looking at code because now you need to know what kind ofthe
module it is in to know what it means. It would have been much more
consistent to just disallow Public in a BAS module since they can't expose
any public (as in external to the project) interface and keep Global as
"correct" way to expose things within the project. It may even have made
more sense to replace Global with 'Friend' in BAS modules since that at
least describes the visibility correctly. Public is just plain wrong.
Absolutely agree.
A poor choice of words on my part if it indeed it came out that I was
suggesting that "Global" was EVER acceptable in Forms/Classes. VB doesn't
(and of course now, will never) support static methods.
It would, however, had been interesting if they had allowed three layers of
scope in bas modules.
Private - no body can see but the module. (like today)
Global - everybody sees (like today)
Public - can be seen if qualified, ie, modMain.Junk(), modData.Junk()
Allowing a kind of 'NameSpace', it would have made it easier to share
modules between projects, and to create real reuseable static "libraries".
Or, just have added yet another feature that no one would use. <g>
-ralph
.
- Follow-Ups:
- Re: Global Const vs Public Const
- From: Michael C
- Re: Global Const vs Public Const
- References:
- Re: Global Const vs Public Const
- From: Jeff Johnson
- Re: Global Const vs Public Const
- From: Bob Butler
- Re: Global Const vs Public Const
- From: Michael C
- Re: Global Const vs Public Const
- From: Stefan Berglund
- Re: Global Const vs Public Const
- From: Bob Butler
- Re: Global Const vs Public Const
- From: Michael C
- Re: Global Const vs Public Const
- From: Ralph
- Re: Global Const vs Public Const
- From: Bob Butler
- Re: Global Const vs Public Const
- Prev by Date: Re: Global Const vs Public Const
- Next by Date: Re: Line concatenation
- Previous by thread: Re: Global Const vs Public Const
- Next by thread: Re: Global Const vs Public Const
- Index(es):
Relevant Pages
|
Loading