misc/redundant-object.xsl:16 reports an object as redundant when
count(key('referenced-by-name', @name)) <= 1, that is, when the whole
document mentions its name once. The count is purely syntactic, so it treats a
lone reference sitting inside a recursive formation the same as a lone
reference in straight-line code.
Those two are not the same. Take eo-runtime/src/main/eo/number/arc-sine.eo:45
in objectionary/eo, where point.times point > squared is declared beside the
recursive helper poly and referenced exactly once, from inside poly. The
lint says it "may be inlined". Following that advice is a mistake: poly
recurses thirty levels, and while the named attribute gives all thirty levels
one shared series.squared node, the inlined form gives each level its own copy
of the point.times point subgraph nested inside the previous level. Running
the eo-runtime suite with the object inlined takes EOarc_sineTest from about
9 seconds to 189, and under the parallel suite the JVM exhausts its heap.
The smallest fix is to skip the defect when the single reference lies inside a
formation that is an ancestor-or-self of a recursive one — that is, when the
referring node has an ancestor o whose own name appears in the @base of one
of its descendants. This is not the same gap as #639 and #640, which are about
references the lint fails to see at all; here the reference is counted
correctly, but one syntactic mention is many dynamic ones.
misc/redundant-object.xsl:16reports an object as redundant whencount(key('referenced-by-name', @name)) <= 1, that is, when the wholedocument mentions its name once. The count is purely syntactic, so it treats a
lone reference sitting inside a recursive formation the same as a lone
reference in straight-line code.
Those two are not the same. Take
eo-runtime/src/main/eo/number/arc-sine.eo:45in
objectionary/eo, wherepoint.times point > squaredis declared beside therecursive helper
polyand referenced exactly once, from insidepoly. Thelint says it "may be inlined". Following that advice is a mistake:
polyrecurses thirty levels, and while the named attribute gives all thirty levels
one shared
series.squarednode, the inlined form gives each level its own copyof the
point.times pointsubgraph nested inside the previous level. Runningthe
eo-runtimesuite with the object inlined takesEOarc_sineTestfrom about9 seconds to 189, and under the parallel suite the JVM exhausts its heap.
The smallest fix is to skip the defect when the single reference lies inside a
formation that is an ancestor-or-self of a recursive one — that is, when the
referring node has an ancestor
owhose own name appears in the@baseof oneof its descendants. This is not the same gap as #639 and #640, which are about
references the lint fails to see at all; here the reference is counted
correctly, but one syntactic mention is many dynamic ones.