Most beautiful programming language feature | Chris Lattner and Lex Fridman

Поділитися
Вставка
  • Опубліковано 23 вер 2024

КОМЕНТАРІ • 91

  • @DrBenVincent
    @DrBenVincent 3 роки тому +88

    Would love to see one of the authors of Julia language interviewed here

    • @gabrielmachado5708
      @gabrielmachado5708 3 роки тому +9

      That would be amazing. It is my favorite language.

    • @OGBhyve
      @OGBhyve 3 роки тому +1

      In the meantime, check this out.
      ua-cam.com/video/VgZm53qgj9Q/v-deo.html

    • @Dr_KAP
      @Dr_KAP 3 роки тому +4

      When your UA-cam suggestions feed is full of 5 minute CLIPS of podcasts you’ve already seen- it’s seriously annoying and is just a tool for the channels to pick up more views. They all do it- Rogan etc. I’m going to block the clips channels so I only get the podcasts ! Sorry my rant, first world problems 😂

    • @reasonerenlightened2456
      @reasonerenlightened2456 3 роки тому +1

      Why the programming languages are still not self-aware in the 21-st century !!!!
      That should really trouble you.

    • @nieczerwony
      @nieczerwony 2 роки тому

      @@reasonerenlightened2456 what troubles me is that in 21st century, less and less ppl are aware of themselfs 😂

  • @jamesnankervis8029
    @jamesnankervis8029 3 роки тому +40

    Algebraic Data Types and exhaustive pattern matching are beautiful language features that enable the creation of high quality libraries. Both of these are fundamental core features of Haskell, OCaml and F#.

  • @sho3bum
    @sho3bum 3 роки тому +21

    I felt the same way with list comprehension and the declarative style of programming which lead me on to a journey to haskell.
    The fact you can create everything in a declarative style makes it composable and composition is beautiful.
    Edit : typo

  • @kelbiekelbie909
    @kelbiekelbie909 3 роки тому +7

    My favourite features in JavaScript is the spread operator and optional chaining. One of the cool things about JavaScript is that you can use features like these before they are in the specification with tools like Babel, so you can technically add your own language features which I think is really empowering.

  • @marna_li
    @marna_li 3 роки тому +7

    .NET (and C#) actually did something right when they added the notion of ValueTypes. A variable of type "int" (System.Int32), or even a "bool" value, may be like any other object from a class but they are being passed by value. I started with .NET, and when I went to Java at college, I got instantly confused that you had to constantly wrap primitive types in classes and lose the value semantics. In .NET this is handled for you by the runtime. The methods are always available on value types. Not to forget the type-erasure generics (Java) vs. runtime generics (.NET). In .NET value is an object, albeit with difference semantics for variables based on type.

  • @gabrielmachado5708
    @gabrielmachado5708 3 роки тому +10

    The broadcast operator in Julia is amazing.

  • @LofiWurld
    @LofiWurld 3 роки тому +10

    Talk about scratch next. The way you can drag block into each other, truly Elegant!

  • @Daniel_WR_Hart
    @Daniel_WR_Hart Рік тому +2

    First-class functions are an addiction

  • @comscinerd2070
    @comscinerd2070 3 роки тому +6

    0:16 list comprehensions are my favorite things ever!

    • @rw-xf4cb
      @rw-xf4cb 3 роки тому +1

      Yeah bit addictive everything became a list comprehension even when it wasn't the best way - had to detox, then I found map!

    • @comscinerd2070
      @comscinerd2070 3 роки тому

      @@rw-xf4cb what's map?

    • @rw-xf4cb
      @rw-xf4cb 3 роки тому +1

      @@comscinerd2070 various languages have map function takes a function and an iterator and calls the function with an item off the iterator. Python map(myfunc, list) will run myfunc with one item off list. Python3 runs as generator so map would have to be consumed with a list(map(myfunc, iterator)) to get the same effect as list comprehension/python2 map. www.w3schools.com/python/ref_func_map.asp

    • @fred.flintstone4099
      @fred.flintstone4099 3 роки тому

      I've used list comprehensions in Python, but I just think it made my code less readable, so I prefer to write it just as simple if statements and for loops instead.

  • @Talk378
    @Talk378 3 роки тому +20

    Linq in c# is 💯

    • @Gabagool22
      @Gabagool22 3 роки тому

      agree

    • @prafesa
      @prafesa 3 роки тому +1

      Yes!

    • @fred.flintstone4099
      @fred.flintstone4099 3 роки тому

      I do agree, LINQ is amazing, well I do love the LINQ library, but I hate the built-in SQL-like LINQ into the language. It is really nice with to query data over an abstraction.

  • @VijayaGopala
    @VijayaGopala Рік тому +3

    It really annoys me when a novel language does not allow me to do ++i%=7; That is such an often-useful expression.

    • @bennri
      @bennri Рік тому +2

      Useful but not readable. Like perl. I've made hundreds of efficient elegant perl scripts that just a week later I could not understand.

    • @schmetterling4477
      @schmetterling4477 Рік тому

      But what does it mean? (Yes, I am using C regularly).

    • @VijayaGopala
      @VijayaGopala Рік тому +1

      @@schmetterling4477 Advancing index in a ring buffer to the next item. The buffer size in this case is 7, can be any positive integer.

  • @isodoublet
    @isodoublet 3 роки тому +7

    It's a little silly to say Int is not a built-in type in Swift. The implication seems to be that there are no special types in Swift, so everything is democratic and user-defined types are just as good as the built-ins. But that's silly since _some_ type has to have a special relationship with the compiler since _something_ has to talk to the hardware. In Swift, that's just e.g. Builtin.Int64, so the only reason Int doesn't have a special relatiosnhip with the compiler is because Builtin.Int64 does! To be fair to other languages, you should compare e.g. int in C with Builtin.Int64 in Swift, and you'll find that (apart from the fact that Builtin.Int64 has crummy syntax) they behave almost identically, as they must. What's more, the Builtin module is not really available for regular programs, only the stdlib. So even Int itself is a special type that an ordinary library developer couldn't write!

  • @НурланМукамбаев

    Proud to see smart men talking about things that really matter. Great job, guys

  • @minionsystems
    @minionsystems 3 роки тому +7

    I agree that libraries are important but making the language too extensible destroys readability because you think you know what "+" means but operator overloading can make it very difficult to understand the code you see because + could be redefined to be "-" making the code unreadable - the same is true for compile time macros. The use of int built into the language is less extensible but it allows the compiler to optimize better. Java, for instance, has both int and Integer - one is value and the other is Object. Really valuable for creating libraries are machine independent byte code, garbage collection and built in thread operators since the library can use these features transparently to the application.

    • @vibovitold
      @vibovitold 2 роки тому

      "+" can be redefined to actually be "-". OK.
      can't an "add" method (function whatever) be redefined to actually "remove" just the same, causing the exact same confusion?

    • @minionsystems
      @minionsystems 2 роки тому +1

      @@vibovitold Yes, but at least we know it is a function and not part of the language itself. It also makes it easier to insert back-door code. I can redefine + to do a proper add but also add a nearly invisible back-door. I.e. it makes the code more difficult to understand and troubleshoot.

  • @simonkotchou9644
    @simonkotchou9644 2 роки тому +3

    Functional options in languages like Python and Java are very satisfying to use. I'm glad functools has been basically integrated into newer python versions. The syntax and elegance of streams in java and builtin (map, reduce, filter) in python gets me everytime

    • @schmetterling4477
      @schmetterling4477 Рік тому

      Functional languages don't scale. Functional expressions look simple, but they are abstracting your performance and scalability away. If all you have to do is to parse a 10k html page, that's fine, but don't try to do serious work on large data without knowing the structure of your data. The universe will end before your program does.

  • @chmoder
    @chmoder 3 роки тому +1

    The ROI / cost+benefit part of this is something I hope everyone can appreciate.

    • @reasonerenlightened2456
      @reasonerenlightened2456 3 роки тому

      Why the programming languages are still not self-aware in the 21-st century !
      That should really trouble you all.

  • @antonios4553
    @antonios4553 3 роки тому +1

    excellent clip! programming, from my beginner's eye, is a game unto itself; you called it a bicycle for the mind. In either case, it does need a more collaborative effect for change. How to convince the ruling bodies such as W3C of such proposals. Hmmm

  • @mattbowden1981
    @mattbowden1981 3 роки тому +13

    I like promises in Javascript.

    • @gabrielmachado5708
      @gabrielmachado5708 3 роки тому +3

      I like being able to add attributes dynamically to the objects (but I also hate it, because of the bugs it causes)

    • @spyroninja
      @spyroninja 3 роки тому +3

      RxJS is sweet tho

    • @reasonerenlightened2456
      @reasonerenlightened2456 3 роки тому +1

      Why the programming languages are still not self-aware in the 21-st century !!!!
      That should really trouble you.

  • @bennri
    @bennri Рік тому +1

    Python's long int. How many bits? It's as long as you need. No overflows.

  • @darkdudironaji
    @darkdudironaji 2 роки тому +3

    Is Python the only language Lex knows? It's the only one I've ever heard him talk about.

    • @ericpmoss
      @ericpmoss 2 роки тому

      I think he knows Lisp to some extent, but he often speaks as though he doesn't really get it.

    • @darkdudironaji
      @darkdudironaji 2 роки тому

      @@ericpmoss Well yeah. Python is one of the easiest languages to get good at and Lisp is one of the hardest. If he only really knows python, that's a huge jump.

    • @Daniel_WR_Hart
      @Daniel_WR_Hart Рік тому +1

      Does he ever specify what dialect of Lisp he uses?

  • @tobyn123
    @tobyn123 3 роки тому +3

    Streams and lambdas make me love Java.

    • @wyqtor
      @wyqtor Рік тому

      Kotlin and Scala do them a lot better, also on the JVM.

  • @pawelpow
    @pawelpow 3 роки тому +2

    Python:
    [x for x in range(1, 101) if myFunc(x)]
    Swift:
    (1…100).filter { myFunc($0) }

    • @gritcrit4385
      @gritcrit4385 3 роки тому +3

      filter myFunc [1..100]
      guess the language

    • @kyovak
      @kyovak 2 роки тому +1

      @@gritcrit4385 not Haskell

  • @JoshBenore
    @JoshBenore 3 роки тому +1

    Lex: You are literally creating suffrage in the world.
    Chris: Its for your own good and I'm totally justified before even considering your comment.

  • @nicholasroman8071
    @nicholasroman8071 2 роки тому +2

    You cannot underestimate JavaScript. I love Python. But in combination with typescript JavaScript is extremely elegant.

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

    4:07 tell us about C++ please
    there is no operator overloading yep? than how all math libraries work? hmmm cool story

  • @chrisE815
    @chrisE815 3 роки тому +3

    Did he answer the question?

  • @thibs0
    @thibs0 3 роки тому +2

    Had a 2s hesitation before hitting the like button... because the "likes counter" was saying 256... and didn't want to make it 257 XD

  • @홍길동-l3t
    @홍길동-l3t 6 місяців тому

    0:59

  • @dylanl9532
    @dylanl9532 3 роки тому

    swift function labeled parameters shouldn't have order

  • @PerfectlyNormalBeast
    @PerfectlyNormalBeast 3 роки тому +1

    Native support for dozenal :)

  • @botfantasies6229
    @botfantasies6229 3 роки тому +6

    Swift has the most beautiful syntax of the languages.

    • @ju7409
      @ju7409 3 роки тому

      this. unfortunately swift is so restricted in use

    • @fred.flintstone4099
      @fred.flintstone4099 3 роки тому +1

      Personally I really like C#.

    • @botfantasies6229
      @botfantasies6229 3 роки тому +1

      @@fred.flintstone4099 I would expect nothing less from Fred Flintstone

    • @wyqtor
      @wyqtor Рік тому

      Python and Julia for me. They both feel like writing pseudocode that can magically run. And without stupid OOP forced on you if you don't want it. And without superfluous braces, because we live in the age of linters and coding standards.

    • @botfantasies6229
      @botfantasies6229 Рік тому +1

      @@wyqtor I definitely don't consider curly braces superfluous, they are like the brush strokes of a painting that give the art depth. Python reads like a book to me. Swift reads like code.

  • @greengoblin9567
    @greengoblin9567 3 роки тому +6

    I agree fully. Arrays in c++ produce a lot of bugs

  • @Neurochrom
    @Neurochrom 3 роки тому

    Operator overloading is not an invention of swift

  • @vegahimsa3057
    @vegahimsa3057 3 роки тому +1

    Swift can't for (;;i++) ?

    • @noon310
      @noon310 3 роки тому +1

      It can with while though.

    • @vegahimsa3057
      @vegahimsa3057 3 роки тому

      @@noon310 it was the i++ I meant to ask about ... I guess not.

    • @aedd3307
      @aedd3307 3 роки тому +1

      i+=1

  • @manantank
    @manantank 3 роки тому

    First Class Functions !

  • @indycinema
    @indycinema 3 роки тому +3

    I bet all that int beauty costs ya in compile time. this is a fine conversation tho.

    • @gjum42
      @gjum42 3 роки тому +5

      Same way object orientation costs you in compile time; but you typically get it back in overall development time (debugging, onboarding), which is usually much more expensive.

    • @GordeevVladimirV
      @GordeevVladimirV 3 роки тому +1

      Costs in run time too

  • @kariabraham2998
    @kariabraham2998 3 роки тому +1

    I LOVE CODEEEEEEEEEEEEEE

    • @alfredomulleretxeberria4239
      @alfredomulleretxeberria4239 3 роки тому

      Code is a lot of different things, and each coder has their own distinguishing set of coding habits. What exactly do you like about code?

    • @deerlow1851
      @deerlow1851 2 роки тому

      @@alfredomulleretxeberria4239 I like it because:
      According to the theory of everything, existence itself ( the entire universe and beyond) is a complex web of systems and subsystems stemming from a singular, simple rule. E.g, given 0 and 1 and a rule to build from these with iterable and growing complexity, when allowed to iterate infinitely, the complexity also grows infinitely, and such the universe is born.
      Coding is like harnessing this power of creation for yourself.

  • @MrJigarparmar
    @MrJigarparmar 3 роки тому

    I like function in HTML

  • @larryseyer
    @larryseyer 3 роки тому

    i = :)

  • @sacredgeometry
    @sacredgeometry 2 роки тому

    8:46 the absence of a c style for loops and the short hand incriminators in swift is annoying.
    It didn't aid design, not to mention their lacklustre implementation of terrible new design practices/ keywords and paradigms has made a massive mess of the language and thoroughly fucked them over.
    You can see it in the way the language is evolving. They make rash stupid design choices and then there is a tidal wave of poor choices to firefight the consequences of it.
    That said I will take it over ObjC any day. It sure as shit looks like its going to be just as bad as that ended up by the end though.

  • @luigi9064
    @luigi9064 3 роки тому +2

    JavaScript is the most beautiful programming language

    • @jamesnankervis8029
      @jamesnankervis8029 3 роки тому +2

      Are you kidding?! How many programming languages have you used?

    • @luigi9064
      @luigi9064 3 роки тому

      @@jamesnankervis8029 4

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 3 роки тому

      But it doesn’t have PICTUREs or ISAM files, like COBOL!
      Honestly, how can you say your language addresses business needs better than COBOL?