I've always wondered how the dependencies are managed from a programming language to its libraries. Take for example C#. When I was beginning to learn about computing, I would assume (wrongly as it turns out) that the language itself is designed independently of the class libraries that would eventually become available for it. That is, the set of language keywords (such as `for`, `class` or `throw`) plus the syntax and semantics are defined first, and libraries that can be used from the language are developed separately. The specific classes in those libraries, I used to think, should not have any impact on the design of the language.

But that doesn't work, or not all the time. Consider `throw`. The C# compiler makes sure that the expression following `throw` resolves to an exception type. `Exception` is a class in a library, and as such it should not be special at all. It would be a class as any other, except that the C# compiler assigns it that special semantics. That is very good, but my conclusion is that the design of the language does depend on the existence and behaviour of specific elements in the class libraries.

Additionally, I wonder how this dependency is managed. If I were to design a new programming language, what techniques would I use to map the semantics of `throw` to the very particular class that is `Exception`?

So my questions are two:

* Am I correct in thinking that language design is tightly coupled to that of its base class libraries?
* How are these dependencies managed from within the compiler and run-time? What techniques are used?

Thank you.

EDIT. Thanks to those who pointed out that my second question is very vague. I agree. What I am trying to learn is what kind of references the compiler stores about the types it needs. For example, does it find the types by some kind of unique id? What happens when a new version of the compiler or the class libraries is released? I am aware that this is still pretty vague, and I don't expect a precise, single-paragraph answer; rather, pointers to literature or blog posts are most welcome.