Skip to content

Comment on Bog – small, strongly typed, embeddable languageparent

Comments

Isn't this exactly what CommonJS does/did?

No, you're thinking of `destructuring`. CommonJS was "just" a common format for defining/importing modules in a NodeJS environment (via `module.exports` and `require`), eventually being used for packaging frontend "applications" as well, popularized by Browserify.

To expand, the following was common before destructuring but with CommonJS:

    var some_func= require('some_module').some_func
Which, as you know, would probably usually be done like this today, where we have destructuring:
    let {some_func} = require('some_module')
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.