jsbml
jsbml copied to clipboard
Deriving a unit for a lambda expression may cause an out of bounds exception
Lambda expressions are placeholders that are filled with arguments when the expression is called. Consequently, their units can in many cases not directly be derived if arguments are passed to the expression. The reason is that SBML does not restrict assignable types in lambda expressions. Consequently, various objects (such as species, compartments, or parameters) could be passed to a lambda expression when a function is called. If used in muliple places, the same function may result in varying derived units. In its current form, the attempt to derive units of a lambda expression itself (i.e., not within a call hierarchy but the structure itself) may result in an out of bounds exception because the lambda expression itself does not know which arguments are possibly passed to it. Those have to be filled in when the expression is called. More specifically, the in methods such as astNodeToTree
wihtin ASTNode
units are derived for the node and for lambda nodes the children are necessary for this derivation. The children are not present at that time, however, because addChild()
is responsible for adding them.
Consequently, the derivation of units from lambda expressions in the corresponding units compiler needs to be revised.