package mantra.lang
Equatable
INTERFACE
public interface
Standard contract for custom types requiring deep structural equality checks.
🏗️ Constructor Summary
Constructor Signature
interface Equatable
⚙️ Method Summary
| Modifier & Return Type | Method Signature | Description |
|---|---|---|
Bool |
equals(other: Any) |
Returns True if the current instance is equal to other. |
🔍 Detailed Method Specifications
pub def equals(other: Any) -> Bool
Returns True if the current instance is equal to other.
💡 Example Usage
equatable_example.mantra
class Point implements Equatable:
def __init__(self, x: Int, y: Int):
self.x = x
self.y = y
override pub def equals(self, other: Any) -> Bool:
return self.x == other.x and self.y == other.y