<commit_before># namespace-include.js for Node.js
Because sometimes you just want to include another Javascript file in the global namespace...

## Hey Rick
I had a friend, a guy I would call up and talk about all manner of technical BS with. His name was Rick, and I knew him for 25 years. He was the smartest person I ever met, and I've been in the room with some of the world's brightest minds so that's no small compliment. Rick passed in June of 2015. This package is dedicated to him, because when I first encountered the way Node.js loads packages, I really wanted to get on the phone and talk it over with him.

## Why do I want to "include" files in my Javascript?
In Javascript, it's very common to use a prototype-based object-oriented programming paradigm. In object-oriented development, it's good practice to split class definitions into separate files. Some languages (such as Java) enforce this split, up to and including the names of the files and directory structure used in the package (I hate that, as a rich class hierarchy is a hornet's nest of directories).

Some of the reasons to encourage splitting code into separate files are to:
- isolate the code and variables that go together, 
- keep code file sizes manageable,
- promote code re-use through well abstracted interfaces, and
- hoist commonly used functionality into a single point of entry (thereby minimizing opportunities for errors in replication and reducing effort when updating algorithms).

## Node.js uses "modules"
To facilitate loading of separate class definition files, Node.js copied the syntax of the perl module loading mechanism (but not the behavior). To bring extra code in, you say something like:

    var myModule = require ("importedModuleName.js");

In the module, you say something like:

    var exportThis = function () {
        ...
    }
    module.exports = exportThis;

The mechanism runs your imported module in a separate VM context and returns `module.exports`. The exported object is available through the variable you assigned it to (in this case, `myModule`). Depending on the usage, the net effect is usually similar to a singleton with static methods on it (think of it like `Math`, where you say something like `var y = Math.sin(x);`).

The primary benefit of this approach is that you avoid polluting the script's global namespace with values from the imported modules. 

A very rich ecosystem of modules has been built around the `require` mechanism using a package definition and the `npm` (node package manager), which connects to an [online registry at npmjs.com](npmjs.com). Ironically the registry namespace has been flooded with more than 200,000 modules battling over appropriate titles. Every single 2 or 3 letter name you can imagine is taken, and most sensible names have been used for *something*, indicating a need for a better solution.
<commit_msg>Hey Rick<commit_after># namespace-include.js for Node.js
Because sometimes you just want to include another Javascript file in the global namespace...

## Hey Rick
I had a friend, a guy I would call up and talk about all manner of technical BS with. His name was Rick, and I knew him for 25 years. He was the smartest person I ever met, and I've been in the room with some of the world's brightest minds so that's no small compliment. Rick passed in June of 2015. This package is dedicated to him, because when I first encountered the way Node.js loads packages, I really wanted to get on the phone and talk it over with him.

## Why do I want to "include" files in my Javascript?
In Javascript, it's very common to use a prototype-based object-oriented programming paradigm. In object-oriented development, it's good practice to split class definitions into separate files. Some languages (such as Java) enforce this split, up to and including the names of the files and directory structure used in the package (I hate that, as a rich class hierarchy is a hornet's nest of directories).

Some of the reasons to encourage splitting code into separate files are to:
- isolate the code and variables that go together, 
- keep code file sizes manageable,
- promote code re-use through well abstracted interfaces, and
- hoist commonly used functionality into a single point of entry (thereby minimizing opportunities for errors in replication and reducing effort when updating algorithms).

## Node.js uses "modules"
To facilitate loading of separate class definition files, Node.js copied the syntax of the perl module loading mechanism (but not the behavior). To bring extra code in, you say something like:

    var myModule = require ("importedModuleName.js");

In the module, you say something like:

    var exportThis = function () {
        ...
    }
    module.exports = exportThis;

The mechanism runs your imported module in a separate VM context and returns `module.exports`. The exported object is available through the variable you assigned it to (in this case, `myModule`). Depending on the usage, the net effect is usually similar to a singleton with static methods on it (think of it like `Math`, where you say something like `var y = Math.sin(x);`).

The primary benefit of this approach is that you avoid polluting the script's global namespace with values from the imported modules. 

A very rich ecosystem of modules has been built around the `require` mechanism using a package definition and the `npm` (node package manager), a stand along program that connects to an [online registry at npmjs.com](npmjs.com). Ironically the registry namespace has been flooded with more than 200,000 modules battling over appropriate titles. Every single 2 or 3 letter name you can imagine is taken, and most sensible names have been used for *something*, indicating a need for a better solution.

{'fraction_non_alphanumeric': 0.048047010024196334, 'fraction_numerical': 0.004839267196681645, 'mean_word_length': 4.299450549450549, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4055430', 'n_tokens_mistral': 1384, 'n_tokens_neox': 1285, 'n_words': 903}