-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dunder methods? #492
Comments
Indeed, dunder methods are "magical" by design and I avoid magic in Jou. It is a simple language that basically doesn't do anything that you don't tell it to do. This means it won't call any methods unless you call them, so magic methods don't make sense. That said, sometimes "practicality beats purity" as Python people like to say. Some simple operator overloading (as in |
So how do I set custom initialization and attribute code that is uniform over a large codebase? If I have to implement different |
In most cases it's easiest to initialize all attributes to zero (or
Jou isn't magical like Python. I will not be adding code that can automagically print/stringify any instance of any class, and recursively do it for all members inside it. I understand why you want that, based on your experience with high-level languages, but this is a lot of magic for a language like C or Jou. Currently the Jou compiler has a method named |
I concede all points. |
Do these exist?
The text was updated successfully, but these errors were encountered: