Add 'again' keyword for recursive calls
The `again` keyword is introduced to facilitate explicit recursive function calls. It is restricted to tail-call positions to prevent dead code and ensure TCO optimization. Type checking is enhanced to validate argument types against function parameters.
This commit is contained in:
@@ -249,6 +249,16 @@ impl StaticType {
|
||||
}
|
||||
elements.iter().all(|e| e.is_assignable_from(inner))
|
||||
}
|
||||
// Tuple to Tuple (Element-wise)
|
||||
(StaticType::Tuple(elements), StaticType::Tuple(other_elements)) => {
|
||||
if elements.len() != other_elements.len() {
|
||||
return false;
|
||||
}
|
||||
elements
|
||||
.iter()
|
||||
.zip(other_elements.iter())
|
||||
.all(|(e, o)| e.is_assignable_from(o))
|
||||
}
|
||||
// A Matrix is a Vector (of Vectors/Matrices)
|
||||
(StaticType::Vector(inner, len), StaticType::Matrix(m_inner, shape)) => {
|
||||
if shape.is_empty() || shape[0] != *len {
|
||||
|
||||
Reference in New Issue
Block a user