Skip to content

Instantly share code, notes, and snippets.

@robotlolita
Created March 9, 2011 17:38
Show Gist options
  • Save robotlolita/862616 to your computer and use it in GitHub Desktop.
Save robotlolita/862616 to your computer and use it in GitHub Desktop.
/*
- Less noises. No semicolons or braces, unless strictly needed.
- Braces shouldn't be on a line of their own, unless they close a
function.
- No strict comparison operator, unless strictly needed.
- Form feed characters to separate pages of the code.
- Heading comments with at least four slashes (for outline-mode)
- Avoid comments inside the function unless strictly needed. Prefer
naming confuse or big chunks of code with a function.
- Concise and meaningful names. Use local variables to bind long names,
always.
- Tabs for indentation, spaces for alignment.
*/
function inherit(ctor, base, props) {
/*** IFDEF DEBUG
assert(base, "Missing `base' parameter")
assert(dbg.isfn(ctor), "`ctor' isn't a function")
*** ENDIF */
if (!props) props = {}
props.constructor = ctor
props.__super__ = base
ctor.prototype = create(base)
return extend(ctor.prototype, props)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment