DCL

An elegant OOP with mixins + AOP for JavaScript.

dclDebug.CycleError

dclDebug.CycleError is present only when dcl/debug is required. It is thrown when dcl encounters an impossible inheritance. For example, when A depends on B, and B depends on A.

Examples

Impossible cycle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var dcl = require("dcl"),
  dclDebug = require("dcl/debug");

var A = dcl(null, {
  declaredClass: "A"
});

var B = dcl(null, {
  declaredClass: "B"
});

var AB = dcl([A, B], {
  declaredClass: "AB"
});

var BA = dcl([B, A], {
  declaredClass: "BA"
});

var Impossible = dcl([AB, BA], {
  declaredClass: "Impossible"
});

// At this point dclError.CycleError will be thrown.

You will see the following exception:

1
2
dcl: base class cycle found in: Impossible -
bases: B, A are mutually dependent

Fork me on GitHub