dreycenfoiles
dreycenfoiles
MModular
Created by dreycenfoiles on 10/31/2023 in #questions
Differences between class and struct
I know classes aren't implemented yet and structs aren't complete, but do we have a sense what they are going to look like when they're done and what their differences will be? I have a few specific questions: 1. Will classes be a high-level pythonic version of structs (like def is to fn) or will classes have low-level performance? 2. I know structs will eventually work with traits and will probably be able to use extensions in a way similar to inheritance. Will classes work with traits or will they have to inherit from other classes? 3. Given that Mojo is aiming for python compatibility, I imagine classes are going to have to support multiple inheritance. Since it can be a pretty controversial feature, will structs support anything like multiple inheritance through multiple extensions?
3 replies