Closed waywardmonkeys closed 6 years ago
The error was:
Internal error: ELEMENT outside of range: 1
The code involved was the h.head[1]
in this:
local method search(el)
let h = el.head;
if (h.head[1] == c2)
reverse(h)
else
let e = edges(h.head[1]);
search(concatenate(el.tail, map(rcurry(pair, h), e)))
end
end;
At the point of the failure, both h
and el
are #()
.
Oh, and c1
is the class object for <socket>
(which is <a>
in my explanation above).
Just to provide a bit more explicit information - I can reproduce this error with the following hierarchy:
define class <a> (<object>)
end;
// Internal error element outside of range
define class <b> (<object>,<a>)
end;
and the code cited above is here: https://github.com/dylan-lang/opendylan/blob/8f1d5d32ba1faf6ba304cfc588da60acf95ddfef/sources/dfmc/conversion/define-class-mop.dylan#L1251-L1259
called from line 1216 here https://github.com/dylan-lang/opendylan/blob/8f1d5d32ba1faf6ba304cfc588da60acf95ddfef/sources/dfmc/conversion/define-class-mop.dylan#L1215-L1219
On a related note,
define class <a1> (<object>)
end;
define class <b1> (<object>)
end;
define class <c1> (<a1>,<b1>)
end;
define class <d1> (<b1>,<a1>)
end;
// <subclass-explanation-2>
define class <e1> (<c1>,<d1>)
end;
gives the curious error
Internal error: The class-4-name slot is unbound in #"<a1>" precedes #"<b1>"
in the CPL of #f because #f is a direct subclass of #"<c1>" and #"<a1>"
precedes #"<b1>" in #"<c1>".
A quick look suggest this may be a copy-paste bug (second class-2:
should be class-3:
)
https://github.com/dylan-lang/opendylan/blob/8f1d5d32ba1faf6ba304cfc588da60acf95ddfef/sources/dfmc/conversion/define-class-mop.dylan#L1208-L1211
and (class-3:
init keyword should be class-4:
)
https://github.com/dylan-lang/opendylan/blob/8f1d5d32ba1faf6ba304cfc588da60acf95ddfef/sources/dfmc/conversion/define-class-mop.dylan#L1159-L1167
I'll try and fix this and the original issue at the same time.
I had an invalid class hierarchy and landed at this stack trace:
The hierarchy was to have a class
<a>
. Then classes<b>
and<c>
inherit from<a>
. Then I had a class<d>
that inherited from both<b>
and<c>
.