Node.js Dot Notation as Namespace Mechanism
In node.js, when you have a dot notation like
x.y
the x
is used purely as a namespace,
not as “data”.
Example:
const p = require("path"); const x = p.extname("xyz.html"); console.log(x); // .html
This is true for about all node.js objects.
This is interesting because the item before the dot is usually considered as a object that represent a piece of data in Object Oriented Programing languages. For example, in JavaScript:
" x ".trim()
Unix Pipe, Dot Notation, Postfix Notation
- Object Oriented Programing (OOP) Jargons and Complexities
- Meaning of Object in Computer Languages
- What is the Difference Between Tag, Element, Node, Object, Attribute, Property, Method?
- Node.js Video Tutorial by Ryan Dahl
- Node.js Creator Ryan Dahl on Software Complexity
- Ryan Dahl, on History of Node.js 📺