Question on variable binding and assignment



My Java for dummies book didn't tell me this stuff. Hope that will
explain where I start when I ask
questions like this. I probably don't even understand what I am
asking.

First, let me quote Touretzky: "the process of creating a new variable
and giving it a value is
called binding...but *bound* doesn't necessarily mean *has a value* for
dynamically scoped
variables". So my first question is that is "giving it a value" the
same as assignment or not?
And why?

Please allow me to expand my question a little further. I am amazed to
read statements like
"Lisp programs don't have to use assignments". Sorry that I have to
resort to other languages
instead of CL in my examples even though I am really trying to learn
the concept in CL.

So, for a statically typed language such as Java, the following code:
int x = 1;
would bind symbol x to a storage area in a computer cell and assign it
to 1. Correct?

Then for a dynamically typed language such as Perl, the following code:
x =1
would bind symbol x to a storage area in a computer cell and assign it
to 1. Correct again?

So what is the practical difference here except one has to declare the
type for "x" in Java?
Is that because in Perl, the variable x can later be assigned to, say,
a character string? But
is that all? If we always assign values to a variable, then what is
the practical use of
an "unbound" variable in a dynamically typed programming language? Why
creating such a
concept of "unbound variables" in a programming language in the first
place?

Well, just thinking aloud here. I saw some interesting examples in Oz
where unbound variables
were used to illustrate the concept of dataflow variables in concurrent
programming. But is
an "unbound variable" totally useless in a non-concurrent program?

I appologize for stating my questions in such a disjoint way. One
problem for being an average-
talented student is that at times like this I know I am confused but
don't know exactly where I am
confused. Sigh...

Doug

.



Relevant Pages

  • Re: Static vs Dynamic
    ... (Java has too much noise in its source code, ... lot to ask and is typical in a typed language supporting polymorphism. ... > developers can easily learn the Java programming language; ... > obivous bugs slip through and b) in many cases, ...
    (comp.lang.lisp)
  • Re: why is "self" used in OO-Python?
    ... and worse this has spread from Java into other ... by whatever happens to be the first OO language they learn". ... If the first programming language (or the ... I have no objection to teaching Java in a CS curriculum. ...
    (comp.lang.python)
  • Re: Public disclosure of discovered vulnerabilities
    ... I spoke of Java; ... > necessary when programming in Java. ... > it is every single programmer who wants to use the language securely. ... this is what we call the "mental model" problem in aerospace. ...
    (sci.crypt)
  • Re: 71% Say Finding New Energy Sources More Important than Conservation
    ... Most of the drive to define was for a test programming language, because each tester had it's own language and the engineer would have to re-write the program every time the testor changed. ... The only reason it was used was because people saw that it would have a longer life time than ADA. ... My group at Stanford switched to Java as their language of choice after giving up on C++ as too flawed to use. ...
    (soc.retirement)
  • Re: why java is not pure object oriented?
    ... For learning I preffer language like Lisp based on ... program fast in latter, but, imho, it's very hard in former (like Java). ... CU> programming which is neither top-down nor bottom-up (though it's ...
    (comp.lang.java.programmer)