$class = function (codec, ctor, sup, proto) {
$.s(ctor)
var c = $.c(ctor, true)
c != Boolean && c != String && c != Number && c != Function
|| $throw($S(c) + ' forbidden')
c.$name && $throw('duplicate class ' + ctor)
if (sup) {
$.f(sup).$name || $throw('super class ' + (sup.name || $S(sup)) + ' not ready')
;(c.prototype = $.copy(new sup.$ctor, c.prototype)).constructor = c
c.$sup = sup
}
$.ctor(c).$name = ctor
if (c.prototype.constructor != c)
$throw(ctor + ' inconsistent with ' + $S(c.prototype.constructor));
proto && $.copy(c.prototype, proto)
codec && ($.cs[ctor] = c)
return c
}