CppCon 2015: Andrei Alexandrescu “Declarative Control Flow"

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 พ.ย. 2024

ความคิดเห็น • 60

  • @jammehcow
    @jammehcow 6 ปีที่แล้ว +60

    All of Andrei's talks are really informative, but he makes them entertaining and enjoyable. Great presenter.

  • @kim15742
    @kim15742 6 ปีที่แล้ว +56

    This guy is so enjoyable to watch!

  • @hitlin37
    @hitlin37 8 ปีที่แล้ว +76

    "Picture this: Imagining like its 1960, this is a guy at conference, he said, you know there is the global variable and it was good." -epic

  • @jaredmulconry
    @jaredmulconry 9 ปีที่แล้ว +25

    This is one of the most entertaining and interesting talks Andrei has given, in my opinion. The techniques made for code that was logically clear, as well as subjectively very clean. He was also on fire in terms of his jokes too, which kept me engaged the whole way through. Great work!
    Also, nicely edited! Some of these CppCon 2015 videos were pretty rough, but this was clean and tidy.

  • @dave_oleksy
    @dave_oleksy 2 ปีที่แล้ว +3

    It just gets better every time I watch it!

  • @disk0__
    @disk0__ 7 ปีที่แล้ว +16

    This is actually a presentation on banter flow

  • @numv2
    @numv2 9 ปีที่แล้ว +28

    That guy is brilliant.

  • @user-ov5nd1fb7s
    @user-ov5nd1fb7s 2 ปีที่แล้ว +6

    "It works better if it is turned on."
    I almost had my coffee coming out of my nose.

  • @BGroothedde
    @BGroothedde 4 ปีที่แล้ว +5

    A great presenter and an interesting subject.

  • @llothar68
    @llothar68 7 ปีที่แล้ว +33

    He is the Chuck Norris of C++ Programming

    • @kuhluhOG
      @kuhluhOG 4 ปีที่แล้ว +2

      yes, and even is one of the inventors of another language

  • @sandrok14
    @sandrok14 5 ปีที่แล้ว +3

    Can someone recommend some beginner-intermediate talks on this channel? Because this is too complicated for me as an early intermediate

  • @vonkruel
    @vonkruel 9 ปีที่แล้ว +3

    The gcc-5.2 I have on my Debian system doesn't have std::uncaught_exceptions, but I just used std::uncaught_exception (bool) for now, and I'll change it soon(?) when the support comes. This gives a nice simplification of code when it's applicable.

  • @ecosta
    @ecosta 3 ปีที่แล้ว +1

    Finishing presentations at the last minute... Been there.

  • @oligophagy
    @oligophagy 9 ปีที่แล้ว +11

    There isn't any meta-programming here. It's simply the RAII + lambdas + the new uncaught_exceptions() to check for normal / exceptional exit from scope, with a bit a preprocessor macros to reduce typing.

  • @ZiadHatahet
    @ZiadHatahet 9 ปีที่แล้ว +2

    What I wanted to imply is that CL and C++ are targeted at completely different segments. We use Scala at work, and there is a library to do scoped cleanup, because Scala is quite flexible. However, we totally miss the ability to do clean ups automatically based on scope. Just because a language offers some meta-programming capability in a fashion that's easier than C++, does not mean it's strictly superior. Furthermore, at the end of the day, this ability is mainly used by library writers [tbc]

  • @acmdz
    @acmdz 9 ปีที่แล้ว +19

    His jokes are the best.

    • @ce5983
      @ce5983 ปีที่แล้ว +1

      I said no refunds 😅😂

  • @hl2mukkel
    @hl2mukkel 6 ปีที่แล้ว +8

    This guy is absolutely hilarious!

  • @GeneralBolas
    @GeneralBolas 9 ปีที่แล้ว

    FYI: `static_if` is not slated for C++17... yet. The committee essentially decided to go the concepts route, but there is a variation of `static_if` called `constexpr_if` that could yet make it to C++17.

  • @gauravarya8952
    @gauravarya8952 5 ปีที่แล้ว +4

    nice anonymous variable trick at 22:44

  • @minecraftermad
    @minecraftermad 3 ปีที่แล้ว +1

    But if copy file fails no file gets copied and then the deletion night succeed which would mean files are gone right?

    • @0xbenedikt
      @0xbenedikt 3 ปีที่แล้ว

      Yeah, but copy throws, if something goes wrong and then exits the function before any cleanup will be done.

  • @ThorX89
    @ThorX89 8 ปีที่แล้ว +1

    Why would using SCOPE_* macros in an inline function ever violate the one definition rule? I can see why using them in macros might, but inline functions get their own scope. There should be no issue there.

    • @AxelStrem
      @AxelStrem 8 ปีที่แล้ว +7

      It's not about the scope of the function, the function itself can have multiple definitions (in more than one translation unit), which often happens to inline functions, e.g. when defined in the class header. Using __COUNTER__ in this case can obviously lead to ODR violation.
      I think this could be fixed using some sort of scope-sensitive __COUNTER__ or simply a macro for local object naming, which could be implemented easily by the compiler, so no reason for Chandler to be such a cockblocker:)

  • @Max-ob8gq
    @Max-ob8gq 10 หลายเดือนก่อน

    🤗thank you Andrei 🤗

  • @mihailmihaylov988
    @mihailmihaylov988 9 ปีที่แล้ว

    For an example of code being executed automatically on certain events, look at the Kenny Tilton's Cells library.
    With it you can create objects where the values of members depend on the values of the members of other objects. When you update one member variable, the values of all dependent members, including in other objects, get updated recursively.
    Will RAII enable you to write such code?

  • @Vermilicious
    @Vermilicious 4 ปีที่แล้ว +5

    He's a good presenter, but I fell off the wagon when he started with the macros.

  • @mihailmihaylov988
    @mihailmihaylov988 9 ปีที่แล้ว +1

    First of all, your question isn't really related to what I said, which is that it is a torture to use C++ for meta-programming. Object lifetime management has little to do with syntactic abstractions.
    But to answer your question - not but so what? For scoped cleanup, which is a great portion of the uses of RAII, it has unwind-protect. For the rest (subordinate objects) there are alternatives.
    Last but not least, CL's meta-programming is so powerful, you could embed a RAII DSL in it.

  • @minecraftermad
    @minecraftermad 3 ปีที่แล้ว

    Id name it on_next_scope_fail but that's because im new to code

  • @ZiadHatahet
    @ZiadHatahet 9 ปีที่แล้ว

    and consumed by application writers, so only relatively few people would need to know all the intricacies of this. With C++14 and C++17, metaprogramming abilities are becoming easier to use by the non-specialists too (see static_assert and static_if for instance).
    I also invite you to check out Rust, it has decent metaprograming capabilities (and planned to get better in the future). For instance, they already have a compile time regex verifier -- if your regex has a bug [tbc]

    • @platin2148
      @platin2148 7 ปีที่แล้ว +2

      Ziad Hatahet To problem with rust is it’s very awkward syntax at least sometimes. Also don’t like cargo wich is what i need for pretty much anything. Also would probably put all in unsafe { } because i want to use raw pointers without this stupid ownership model.

  • @ДенисГладкий-х6щ
    @ДенисГладкий-х6щ 9 ปีที่แล้ว +1

    You should definitely look at D ;)

  • @0xUltraHex
    @0xUltraHex 3 หลายเดือนก่อน

    Room full of computer geeks and there's an issue with the slideshow. Classic.

  • @douggale5962
    @douggale5962 8 ปีที่แล้ว +5

    I hate macros too.

    • @tikabass
      @tikabass 7 ปีที่แล้ว +6

      I don't like typing the same thing over and over....

  • @yash1152
    @yash1152 ปีที่แล้ว +1

    23:45 watch later

    • @yash1152
      @yash1152 ปีที่แล้ว +1

      32:04

    • @Max-ob8gq
      @Max-ob8gq 9 หลายเดือนก่อน

      @@yash1152

  • @ZiadHatahet
    @ZiadHatahet 9 ปีที่แล้ว

    ... the program will fail to compile. Quite awesome.

  • @georgeshopov8504
    @georgeshopov8504 9 ปีที่แล้ว +5

    This approach makes a good spaghetti of the code. Good luck debugging that mishmash.

    • @HebaruSan
      @HebaruSan 7 ปีที่แล้ว

      Right? 18:25 - "What does this guy do?" It creates bugs, because no one understands it.

    •  7 ปีที่แล้ว +1

      HebaruSan it's pretty straightforward 😅

    • @seditt5146
      @seditt5146 5 ปีที่แล้ว +4

      How can you guys not understand #SCOPEFAIL{ do shit } Bah... Get off my lawn you kids lol, straight up spoiled by modern C++ don't know shit about real programming.

  • @mihailmihaylov988
    @mihailmihaylov988 9 ปีที่แล้ว +9

    Look, I'm not saying lisp is superior in every respect. There are things in it I don't like.
    But this presentation involves meta-programming, and what I'm saying is that C++ is extremely bad at this. To really appreciate how bad, you should compare it to the best meta-programming language, and that's lisp. Until you know what's possible (and easy), you can't really see how much C++ is missing in this area.
    BTW, Andrei is great as usual, but he's forced to use a very bad tool for the task.

  • @QuentinUK
    @QuentinUK 8 ปีที่แล้ว

    ok

  • @mihailmihaylov988
    @mihailmihaylov988 9 ปีที่แล้ว +2

    If you think this is cool, you should read "On Lisp" and "Let Over Lambda". There's much cooler stuff than this before page 40. And by the end of these books you'll have seen so many cool constructs that will never be possible in C++, and done so effortlessly , you'll never admire any "meta" programming in C++ ever again.

    • @walter0bz
      @walter0bz 7 ปีที่แล้ว +1

      lisp is elegant but you pay in runtime cost

    • @tetramaximum
      @tetramaximum 7 ปีที่แล้ว +2

      I am not sure about what you mean by "runtime cost", but must say that 1) there are different implementations of lisp and 2) lisp can have compile time in runtime. This cost is somehow inevitable, just for C++ it is clearly separated from runtime. Also as far as I know in SBCL generated runtime is on par with C. For me the problem with lisp is in too steep ladder of abstraction.

    • @GeorgeTsiros
      @GeorgeTsiros 6 ปีที่แล้ว +2

      walter0bz 99% of performance issues in the real world is because of shit code not because someone used lisp instead of cpp

    • @SeriousAlexej
      @SeriousAlexej 6 ปีที่แล้ว +2

      Nah, its because noone uses lisp anyway, lol.

  • @CartoType
    @CartoType 9 ปีที่แล้ว +3

    I gave up after five minutes of waffle and facetiousness. This is not the way to do a presentation.

    • @KristoffelPirard
      @KristoffelPirard 8 ปีที่แล้ว +5

      Though I agree with the style-dismay, I watched it out. It was worth it.

    • @ihatenumberinemail
      @ihatenumberinemail 7 ปีที่แล้ว +1

      You've got to suffer through the waffle, it's pretty good.

    • @tetramaximum
      @tetramaximum 7 ปีที่แล้ว +17

      For me everything was perfect, including the humor. I bet it depends on culture: for me it is compatible, for you seems to be not.

    • @xarcaz
      @xarcaz 7 ปีที่แล้ว +10

      "Waahhhhhh, wahhhhhhhh, waaaahhhhh...!" -Graham Asher, -2015

    • @ce5983
      @ce5983 ปีที่แล้ว

      The introductory waffle and facetiousness (which I enjoyed and glad was recorded for posterity) ends and the material of the talk @6:00