Mojo and Python type system explained | Chris Lattner and Lex Fridman

Sdílet
Vložit
  • čas přidán 3. 06. 2023
  • Lex Fridman Podcast full episode: • Chris Lattner: Future ...
    Please support this podcast by checking out our sponsors:
    - iHerb: lexfridman.com/iherb and use code LEX to get 22% off your order
    - Numerai: numer.ai/lex
    - InsideTracker: insidetracker.com/lex to get 20% off
    GUEST BIO:
    Chris Lattner is a legendary software and hardware engineer, leading projects at Apple, Tesla, Google, SiFive, and Modular AI, including the development of Swift, LLVM, Clang, MLIR, CIRCT, TPUs, and Mojo.
    PODCAST INFO:
    Podcast website: lexfridman.com/podcast
    Apple Podcasts: apple.co/2lwqZIr
    Spotify: spoti.fi/2nEwCF8
    RSS: lexfridman.com/feed/podcast/
    Full episodes playlist: • Lex Fridman Podcast
    Clips playlist: • Lex Fridman Podcast Clips
    SOCIAL:
    - Twitter: / lexfridman
    - LinkedIn: / lexfridman
    - Facebook: / lexfridman
    - Instagram: / lexfridman
    - Medium: / lexfridman
    - Reddit: / lexfridman
    - Support on Patreon: / lexfridman
  • Věda a technologie

Komentáře • 35

  • @LexClips
    @LexClips  Před rokem +2

    Full podcast episode: czcams.com/video/pdJQ8iVTwj8/video.html
    Lex Fridman podcast channel: czcams.com/users/lexfridman
    Guest bio: Chris Lattner is a legendary software and hardware engineer, leading projects at Apple, Tesla, Google, SiFive, and Modular AI, including the development of Swift, LLVM, Clang, MLIR, CIRCT, TPUs, and Mojo.

  • @Fuego958
    @Fuego958 Před rokem +4

    Super excited to try out Mojo

  • @kalpakHere
    @kalpakHere Před rokem +4

    mojo is basically trying to weave rust, c++, python into a unified platform and have compiler as a service (may be)

  • @ivan.jeremic
    @ivan.jeremic Před 3 měsíci +1

    Man I wish someone like Chris Lattner came to JavaScript to rebrand and fix it.

    • @scosminv
      @scosminv Před 26 dny

      This is the misision of TypeScript.

  • @larryjeffryes6168
    @larryjeffryes6168 Před 4 měsíci

    I only know AutoLISP. I want a LISP that talks to the net and peripherals easily and can run or at least manipulate standard office software like spreadsheets, CAD, word processors etc. what comes closest to that?

  • @rezakghazi
    @rezakghazi Před rokem +1

    Does Mojo supports arbitrary integer as Python does (natively, not using an extra library) but with more speed, as Mojo claims? Or it has cons, the same as the statically typed languages which use bit-related ints. Inventing this type of ints was a fantastic gift to numerical analysis, but the only problem is because they rely on vectors on the compiler side, they need to be faster in huge numbers. If Mojo, as they announced (and I never had a chance to work on it), is 35k faster, this ability can help the concepts.

    • @davidagnew8465
      @davidagnew8465 Před rokem +1

      Mojo targets the AI community. They aren't much into super-long ints. E.g., some AI hardware actually implements 16-bit floats. Those aren't so precise, but some NNs deal with a pantload of them.
      Python definitely does large integers. E.g., try:
      >python -c "p=print;n=13**1003;p(f'{n:,}');import math;logn=math.log(n);p(logn);p(len(str(n)));p(logn/math.log(10));p(math.exp(logn))"
      It prints out the 1003rd power of 13. All 1,118 digits, complete with thousands separator. It also prints the number's base-10 log. But it scores an overflow error trying to convert it to a float.

    • @rezakghazi
      @rezakghazi Před rokem

      @@davidagnew8465 Yes, I know the floating point is the central issue in computer architecture, and it doesn't matter which programming language you use. My main concern was "int" data types, and I got my answer. Thanks.

    • @niks660097
      @niks660097 Před 27 dny

      @@davidagnew8465 I mean AI community not using super-long ints is not actually true, when you are building/researching new kinds of models or training methods, you need unlimited precision to debug your model or reduce classification errors, then when its correctness is tested, you can build a production model on int 4 or int 8, but high precision is still very important, that's why things like AVX 512 are still used in industry for researching AI.

  • @janklaas6885
    @janklaas6885 Před rokem

    📍18:30

  • @xyzzy7145
    @xyzzy7145 Před rokem +2

    Strict typing is analogous to seat belts. Trying writing code in Zig - at first it's a pita, and will probably make you grumpy, but once you understand why Zig has strict typing (and thoughtful allocation...) you'll write better code. Lex, consider an interview with Andrew Kelley ...

  • @user-dy7bw9fm4b
    @user-dy7bw9fm4b Před rokem

  • @kaynefry
    @kaynefry Před rokem

    👌

  • @ajit_edu
    @ajit_edu Před rokem +4

    I too stick to python because of not needing to define type

    • @bayrock1337
      @bayrock1337 Před rokem +5

      As a JS dev I relate, but then eventually you come to understand that (strong) static typing has a purpose and you end up with solutions like TypeScript or Mojo..

    • @Art-is-craft
      @Art-is-craft Před 7 měsíci

      @@bayrock1337
      Strict type based programs tend to be very much a niche and are better suited to engineers, mathematicians and data engineering.

  • @RobertLugg
    @RobertLugg Před rokem

    I can’t see the advantage of this versus cython+the optional type system Python already has. What am I getting wrong?

    • @TCH534
      @TCH534 Před rokem

      My guess is the cython is a bit harder to use.

    • @davidagnew8465
      @davidagnew8465 Před rokem +7

      Python's bolted-on type declarations are useful as documentation and enable independent type checking utilities to catch bugs. Mojo, however, actually translates Python into optimized machine code that can take advantage of special hardware available on some platforms. That's how the 35,000-folds speedup can occur.
      Up until Mojo, if your Python wasn't fast enough, you needed to rewrite the critical parts in C or C++ or Rust or whatever. With Mojo all you need to do is to add whatever additional incantations Mojo needs to your time-critical Python source code. That's a lot less work.

    • @pandr3s
      @pandr3s Před rokem +2

      @@davidagnew8465 Have you tried fully typing an already deployed Python application? You may as well rewrite it.

    • @Michallote
      @Michallote Před 2 měsíci

      ​@@pandr3syeah the type system isnt as well thought out. If you have linters enabled like mypy almost every library will throw warnings and tell you it does not work unless you type the parts of the library you are using...

  • @karigucio
    @karigucio Před rokem +7

    gradual typing ala mypy/mojo is the worst design point in the space. There's just no advantage compared to type inference on the user side. In every programming language you can program in any style, its just a matter of what is the least-friction default - if types are optional, then there's essentially no type guarantees for anything more complex in a codebase developed with deadlines and time constraints. Also, lack of typing in single place may destroy the whole compiler optimization thing, if unlucky.

    • @usefulalgorithms659
      @usefulalgorithms659 Před rokem +2

      🤦‍♂️

    • @marcossidoruk8033
      @marcossidoruk8033 Před rokem +2

      ​@@usefulalgorithms659There is nothing of what this guy said that is even remotely close to being untrue, IDK what the 🤦🏼‍♂️means, probably an expression of your own ignorance?

    • @usefulalgorithms659
      @usefulalgorithms659 Před 11 měsíci +4

      @@marcossidoruk8033 In any program you can define a threshold under which everything is compiled and above which types are interpreted. If you cannot, this is because of a bad design idea, and, even in that case, it can be solved creating a correspondence for each not typed datastructure into a typed datastructure. Any machine learning library like tensorflow or pytorch do that to compile the code into a computational graph. And even the cpython interpreter in itself if you read the code do that (in the opposite way, i.e. instructions are firstly compiled in bytecode that interpreted).
      Optional typing is just a way to speed up the development and optimize-where-you-need, maily designed to stop working 8 hours per day as in 1920 (even with computers and additional support) just because the customer needs a boost in computer execution speed.

    • @Sitron_
      @Sitron_ Před měsícem

      Mojo is statically typed, but one of the types is called PythonObject which you only really use when you want to do Python stuff

  • @ClownWorldOrder
    @ClownWorldOrder Před rokem +4

    this guy's voice and cadence sound like elon musk

    • @wilfred5656
      @wilfred5656 Před rokem +3

      He speaks better than Musk

    • @RealNewsMMA
      @RealNewsMMA Před rokem

      Probably communicates with Elon. Would honestly be more shocked if not. Though one explanation may be this guy watches a ton of Elon musk and has taken up some of his speech. I know growing up in Newfoundland people though it was strange I never had a strong accent for living here, but i chalked it up to me spending a lot of time talking to people on Xbox from other places around the country/world.

    • @ronaldomcdonaldo6289
      @ronaldomcdonaldo6289 Před rokem

      he has Michael Shannon like features

    • @raianmr2843
      @raianmr2843 Před 11 měsíci

      they bought the white nerd voice pack

  • @jorge1869
    @jorge1869 Před 11 měsíci

    A ghost language.