I have never heard of deep and shallow binding. Where do you have these terms from?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
The way that I understand it is that in some languages you are allowed to have methods imbedded in other methods or method used as a parameter to a method call. In such cases if the "inner method" or function uses the same variable values as the calling method, then you have deep binding, if the outer methods scope does not encompase the inner method then you have shallow binding. Since Java does not allow this is it not an issue. However, if you COULD do that and your outer method had a variable that hides a static variable, when you are in your inner method a language with deep binding would use the outer classes understanding of the variable. A language with shallow binding would use the static variable itself. (This is based on a rather sketchy understanding). Found a quote from [url=http://xarch.tu-graz.ac.at/autocad/lisp/FAQ-link/msg00644.html[/url]
>There is a tradeoff between shallow and deep binding. Shallow binding >makes dynamically bound variables faster at the expense of making >stack switching slower, deep binding makes stack switching faster, but >slows down lookup of dynamic variables.
[ January 16, 2003: Message edited by: Cindy Glass ]
"JavaRanch, where the deer and the Certified play" - David O'Meara
hi Cindy, you are right. i tried to Google on this topic and found that this binding stuff is mainly related to LISP etc (and little to Perl)... its confusing. its so confusing. i am still unclear but i don't want to know exactly as most languages like C , java doesnt have it...and i 'm not seeing myself doing LISP regards maulin
Wow. Cindy that was a hell of a response that did confuse me too, but very informative I must say. It was an phone interview question and they also did ask about shallow copy and deep copy which I imagine are not the same thing. Thanks to all for the explanation.
Joined: Sep 29, 2000
Well shallow copying is much more simple. If you copy an array (or whatever) and just copy the references, but both the new array and the original actually point to the SAME objects - then that is a shallow copy. If you copy the array AND make copies of all of the objects that are being referenced - then that is a deep copy.
Joined: Aug 20, 2002
Cindy, thanks again for the short and to the point definition, I suppose it's the same as in C++. That makes sense, the binding question was another thing, they had asked me on a phone interview and I just said I didn't know. I guess that was the best thing!
Probably it's about class loading. In C/C++ if somethere exists call of some function, in the linkage the code of the function (obj) must exists. In Java it depends of JVM, as I know in Sun JVM the JVM doesn't load all classes at the begins (before any executing), so it can be that at the middle of execution - JVM found that program use some class, that doesn't exist at all... Probably deep binding should check that all classes exists (and probably load they all before execution. (really in the Java can't be full deep binding - loader can check all, but not dynamic class loading - Class.forName( ))
encountered a term called 'binding' in some java-corba reference (whose name i am still trying to remember and look for) anyway, it sort of refers to the 'binding' of an object reference with a 'name' (which could be a String) in a corba naming service. this service stores object references and when objects are stored, a name must be provided that is unique within the naming service. So when a an app (e.g. java app) wants to get such an object from the naming service, it could just submit the 'name' and it will be given the object (if such a 'name' is 'binding' to an object). I don't know however, how this 'binding' could be made shallower or deeper. hope this relates somehow.
Joined: Aug 20, 2002
Boyet. The only time I came across strings and binding was using JNDI, contexts and lookups. Frankly, I don't know if they do have anything to do with binding, but I will try to look up some stuff. Thanks.
Joined: Jun 24, 2002
In the Java spec no used word "bind" in the part about I wrote recently - used word "resolve" (12.1.2 Link Test: Verify, Prepare, (Optionally) Resolve) So I don't know means of "binding" in the context. ;-)