The hidden superpowers of linear types: how linear types control the future and prevent bugs

Поділитися
Вставка
  • Опубліковано 6 лют 2025

КОМЕНТАРІ • 15

  • @vipierozan99
    @vipierozan99 2 місяці тому

    A blog post going a bit more in depth on this would be awesome

  • @Navhkrin
    @Navhkrin 2 місяці тому +3

    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.

    • @CYXXYC
      @CYXXYC 2 місяці тому +1

      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

  • @xandervermaak2937
    @xandervermaak2937 2 місяці тому +2

    Linear types are cool.
    Getting feedback on the state of the language would be cooler.

  • @jeffg4686
    @jeffg4686 2 місяці тому

    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?

  • @analyticshub499
    @analyticshub499 2 місяці тому +6

    If something cannot be clearly explained it’s possibly not correctly implemented

    • @empathy_monster
      @empathy_monster 2 місяці тому +9

      I would say that's the point of discussion, to iterate on and refine something until its implementation is agreed upon.

  • @DearGeorge3
    @DearGeorge3 2 місяці тому

    Is it possible to use garbage collector behavior for Python dynamic code? I'd prefer to avoid such complex programming.

    • @melodyogonna
      @melodyogonna 2 місяці тому

      Maybe, or maybe it won't be necessary. Mojo's classes will be as close to Python's though whenever it becomes available

    • @DearGeorge3
      @DearGeorge3 2 місяці тому

      ​@@melodyogonna When it can happen approximately? I dream to switch from Python.

    • @melodyogonna
      @melodyogonna 2 місяці тому

      @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.

  • @mawkuri5496
    @mawkuri5496 Місяць тому

    when will mojo be compatible on windows. i dont like wsl

    • @modularinc
      @modularinc  Місяць тому +1

      Hi there, Windows support isn’t currently on our roadmap.

  • @deepfakescoverychannel6710
    @deepfakescoverychannel6710 2 місяці тому

    dead lang