Okay this is really interesting. It makes me curious however if we could take this one step further. Ultimately, goal here is to make sure a function in object is called. Though destruction itself is not always desired behavior. It would be pretty interesting if we could tell compiler to perform checks on objects beyond just explicit destruction. For example, make sure method1 is called before method2. This could prevent usages of an object before it is fully setup. Compile time check programmability in this aspect would allow library developers to add extensive checks to make sure everything is being used as it should be. I can see something like this being somewhat complicated to add on Mojo side, but it would also be very powerful and make Mojo an extremely safe language to use. Though I think it would be possible to do some object/handle haggling to achieve same behavior with linear types.
with some boilerplate, you can do this *without* any special language-level features (except maybe move/ownership semantics): have method1 consume object of type HasToCallMethod1First, and return object of type CanCallMethod2Now which then has method2. the boilerplate is that fields will have to be passed over individually, methods that can be called on both types will need to be repeated (or inherited from common interface/superclass) 47:11 btw
And here's my definition: A linear type enforces that a resource cannot be shared or duplicated, ensuring it is used in a predictable and controlled way that involves manual deletion so that you don't run into memory issues. How is that?
@DearGeorge3 I think there is a good chance it happens next year. How ever, I don't have this on good authority since I don't work for Modular, just based on the rate of progress to the overall language.
A blog post going a bit more in depth on this would be awesome
Okay this is really interesting. It makes me curious however if we could take this one step further. Ultimately, goal here is to make sure a function in object is called. Though destruction itself is not always desired behavior. It would be pretty interesting if we could tell compiler to perform checks on objects beyond just explicit destruction.
For example, make sure method1 is called before method2. This could prevent usages of an object before it is fully setup. Compile time check programmability in this aspect would allow library developers to add extensive checks to make sure everything is being used as it should be. I can see something like this being somewhat complicated to add on Mojo side, but it would also be very powerful and make Mojo an extremely safe language to use.
Though I think it would be possible to do some object/handle haggling to achieve same behavior with linear types.
with some boilerplate, you can do this *without* any special language-level features (except maybe move/ownership semantics): have method1 consume object of type HasToCallMethod1First, and return object of type CanCallMethod2Now which then has method2. the boilerplate is that fields will have to be passed over individually, methods that can be called on both types will need to be repeated (or inherited from common interface/superclass)
47:11 btw
Linear types are cool.
Getting feedback on the state of the language would be cooler.
And here's my definition:
A linear type enforces that a resource cannot be shared or duplicated, ensuring it is used in a predictable and controlled way that involves manual deletion so that you don't run into memory issues.
How is that?
If something cannot be clearly explained it’s possibly not correctly implemented
I would say that's the point of discussion, to iterate on and refine something until its implementation is agreed upon.
Is it possible to use garbage collector behavior for Python dynamic code? I'd prefer to avoid such complex programming.
Maybe, or maybe it won't be necessary. Mojo's classes will be as close to Python's though whenever it becomes available
@@melodyogonna When it can happen approximately? I dream to switch from Python.
@DearGeorge3 I think there is a good chance it happens next year. How ever, I don't have this on good authority since I don't work for Modular, just based on the rate of progress to the overall language.
when will mojo be compatible on windows. i dont like wsl
Hi there, Windows support isn’t currently on our roadmap.
dead lang