Hades defines two ways to bundle related data together: classes, which combine data and behaviour with support for constructors, instance methods, and operator overloading; and structs, which are lightweight named field aggregates with no behaviour of their own.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ToberlerOhn/hades/llms.txt
Use this file to discover all available pages before exploring further.
Classes
A class definition opens with the class name, a colon, theclass keyword, and a body block. Inside the body you place a creator (the constructor), zero or more method definitions, and optional operator overloads.
Defining a class
creator
The constructor. Always named identically to the class. Receives
me as its first parameter (similar to self or this).method
An instance method. Also receives
me as its first parameter, giving access to all instance variables and other methods.operator
Overloads a built-in operator for instances of this class. Receives
me and must declare a return type.The my. keyword
Inside a creator, method, or operator, use my. to reference or declare instance variables and call other methods on the same instance. It plays the same role as this in Java/C++ or self in Python.
Creating an instance
To instantiate a class, write the class name followed by{ } containing the constructor arguments (in order, no labels):
Operator overloading
Any unary or binary operator can be overloaded per-class using theoperator keyword followed by the operator symbol and a function signature:
Structs
A struct is a pure data container — a named schema of typed fields with no methods. Use structs when you need to group a fixed set of values without behaviour.Defining a struct
Creating struct instances
Hades plans to support two instantiation styles:- Positional
- Named
Classes vs. structs at a glance
| Feature | Class | Struct |
|---|---|---|
| Constructor | creator (required) | positional or named init |
| Methods | method keyword | none |
| Operator overloading | operator keyword | none |
| Instance keyword | my. | field names |
| Type annotation on instance | ClassName | struct<StructName> |
Both classes and structs are planned features of the Hades type system. Follow the project repository for updates on interpreter support.