Quiz
- Are modules and libraries similar?
Yes! In fact, most programs using the C language (one of the oldest still in common use) start with:
which "imports" the Standard Library.
So, yeah, they're similar ideas: importing/including stuff into our programs.
- Still not too sure what modules are
They are a feature of the programming language to better allow us to "divide and conquer". A module
- might be part of the ecosystem, allowing our program to access the OS, file system, network, do math or graphics, etc. (so, written by others)
- might be written by other members of our "team" or
- might be written by ourselves, but we are trying to divide our code into conceptually and functionally distinct parts.
- can you talk about what you mean by execution contexts and why they're not technically namespaces?
Sure. An execution context is the set of names that are available at a particular point in the code. For example:
The set of names available at point A is a strict subset of those available at point B, and so forth.
Some people (me) would call those different namespaces; others would call them different executation contexts. But that's a minor point of terminology. The important thing is understanding how they differ.
- Can we still call the module we imported outside the <script type="module"> tag?
Well, we don't call modules (they are not functions), but if you mean use the names in them, then I think the answer is no. The spread of names is strictly controlled.
- Can we walk through the code for the App example? / I am still confused with the App example. Can you please re-explain in class?
For sure!
- No questions for now, but I'm loving the class!
I'm so glad to hear it!