Re: Global Const vs Public Const




"Bob Butler" <tiredofit@xxxxxxxxxxx> wrote in message
news:u1RZTnm1GHA.1548@xxxxxxxxxxxxxxxxxxxxxxx
"Ralph" <nt_consulting64@xxxxxxxxx> wrote in message
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
depending
on where it was used; part of the public interface of the creatable object
for forms and classes or 'global to the project' in a BAS module. There
was
no need to give Public this dual meaning since the Global keyword already
existed and was handling the one case quite nicely and it only introduced
an
ambiguity when looking at code because now you need to know what kind of
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
the
"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


.



Relevant Pages

  • Re: Global Const vs Public Const
    ... an eol language there's no point avoiding the eol keywords :-) ... reason to also change Global in bas modules to Public. ...
    (microsoft.public.vb.general.discussion)
  • Re: Global Const vs Public Const
    ... leading in a given direction is no reason to follow. ... BAS modules and always meant 'global to the project'. ... part of the public interface of the creatable object ... no need to give Public this dual meaning since the Global keyword already ...
    (microsoft.public.vb.general.discussion)
  • Re: Property Get/Let versus Global Variables
    ... Can anyone come up with a reason to use them in standard BAS modules? ... Anytime there is a need for additional action to be taken in addition to changing the value ...
    (microsoft.public.vb.general.discussion)
  • Re: Global Const vs Public Const
    ... Public was a mistake IMO ... He was referring to the 'dual' nature of Public and Global in bas modules, ... syntax checker will accept either. ... and disallowed 'Public' in bas modules. ...
    (microsoft.public.vb.general.discussion)
  • Re: Global Const vs Public Const
    ... objects means -> declared as part of the default or Public Interface. ... He was referring to the 'dual' nature of Public and Global in bas modules, ... syntax checker will accept either. ... and disallowed 'Public' in bas modules. ...
    (microsoft.public.vb.general.discussion)

Loading