Is it possible for there to be a "strict" mode? #192
Replies: 1 comment
-
Mojo is a superset of python, so don't think of it is "structs are mojo and classes are python". It is better to think about it that "classes are dynamic and structs are static". It's not that one or the other is better than the other, it is that they are better and worse at solving different problems. Python is a great example of this: classes "can" be used to do everything, but they aren't /very good/ at some of them (eg defining a complex number with the real/imaginary components looked up dynamically). The mojo viewpoint is that you use the right tool for a job. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Since for compatibility reasons, there's two (or more) ways to do almost everything in the language, it seems like it might be a lot of cognitive overhead to bounce back and forth in a particular file where people have switched paradigms between classes and structs and fn's and defs, etc.
I think it would be nice if there were a way to declare that a particular module is to be written in "strict" mode where you can only use the "mojo" way of doing everything, while still being able to import python (or other non-strict) modules.
Is this something that already exists in the language? And is that a good idea?
Beta Was this translation helpful? Give feedback.
All reactions