help me understand programming grammar
August 14, 2006 11:36 AM Subscribe
How do I learn what goes on "under the hood" of programming languages?
posted by grumblebee to computers & internet (34 answers total) 15 users marked this as a favorite
I HATE HATE HATE doings something "just because that's the way you're supposed to do it." I am not comfortable until I understand WHY I have to do it that way. Also, I've found that every time I've gotten to understand the logic behind a language construct -- the logic of the language's designers -- I become a better programmer.
I'm talking about basic stuff here, like what exactly is an operator and how is it different from a function? Why, in many languages, do we say x = Math.cos(3), but not x = Math.add(3,4)? Why is it x = 3 + 4. I realize that this sort of thing varies from language to language, but what is the decision based on.
What does the "new" mean when you create an object instance via something like var cat = new Feline()? I totally get that you're running a constructor function inside the Feline class. But what IS "new"?
Since my major programming language is actionscript, and since that language is about to radically change (ver 2.0 --> ver. 3.0), I recently got puzzled by the fact that in the old version, ALL data types are capitalized: Boolean, String, Void... Whereas in the new version, some are capitalized and some aren't. String, int, void, Boolean...
I spent about three hours searching the web for the WHY of this, and pretty much all I found were rules: remember that void now starts with a lower-case V. Fine. But WHY? What does it mean?
Feel free to answer these specific questions, but I come up with more like them every week. I'm more interested in a good source -- or sources -- to help me understand all these sorts of things (mostly in C-based languages). I'm a pretty smart guy, but I don't have a CS background. So I'm hoping for something that a sharp lay-person can get.