Sgqvur
FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
- Reaction score
- 62
----I was "thinking" about the word static and it's usage and meaning in
the programming languages. I am not sure if the C language was the one
to introduce it but it's usage is strange for me at least. I know a
little C but I think I know what static does. Prepended to a global var-
iable or function make it only visible and usable to the file/compilation
unit it is declared/defined. Prepending it to a local varaible makes the
variable sort of anonymous global so to speak making it only visible and
usable to the function. So it seams static is a visibilty modifier for
the variable/function that follows it. So how logical is static for you?
For me more logical names for a visibilty modifier are hidden (I think
you can agree that hidden is describles presisly what is meant by static.
In the global case it hides the variable/function from the rest of the
compilation units. In the local case it hides the variable from the rest
of the code in the unit and of course it's value is saved not lost like
the rest of the local variables.), my (as in you can't have my global int
=) and this is my var/function there are many like it but this one's mine)
visibleonlyhere is rather verbose and private of course makes sense as
well. I was "thinking" about something starting with un... but only came up
with unavailable =), I would pick static too if only unavailable was
available. But anyway... enough about it's meaning and usage in C. The
reassion it was picked up by the creators of the language is I guess
borrowed from the Science of Physics in which static has the meaning of
"unable to change", "fixed", "Something that is not part of any perceived
universe phenomena; having no motion; no particle; no wavelength". Hm
I think I am starting "to getting it", so static var/function means
unchangeable for the rest of the code but not here? So change[able]hereonly
is another logical name?
----Moving to the OOP langguages from the C family C++, Java, C#, D etc.
But it seams in general that in Computer Science that the word static
has a lot of meanings (not just double, triple, quadriple meaning but
also sextuple and more... In those languages the meaning of static is
even more foggy. Prepended to a variable it makes only one copy of it
for every instance of the class to access (sound like shared to me) and
prepended to a method it stands for litteraly a function which name
when used outside of the class begings with the class's name follow by a
dot and the name which the user picked (I think there are some additinal
rules like only able to access other static data and what not). So the
meaning of static (something unchangeable, fixed) that was hard to find
in the usage of C is lost entirely here. So why did the smart people
behind those languages rather carelessly copied it over? So in my opinion
shared (intead of static) and simple function (instead of static method)
is simpler and easier to grasp.