DCL

An elegant OOP with mixins + AOP for JavaScript.

dcl.CycleError

Version 2.x

dcl.CycleError is present only when dcl/debug is imported. Otherwise, Error will be thrown.

It is thrown, when dcl encounters an impossible inheritance. For example, when A depends on B, and B depends on A.

dcl.CycleError is based on dcl.DclError.

Examples

Impossible cycle
1
2
3
4
5
6
7
8
9
10
11
12
var dcl = require("dcl/debug");

var A = dcl({declaredClass: "A"});
var B = dcl({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 dcl.CycleError will be thrown.

You will see the following exception:

1
dcl: base class cycle in Impossible, bases (AB, BA) are mutually dependent