CppNorth
CppNorth
  • 113
  • 365 180
Message Handling with Boolean Algebra - Ben Deane
cppnorth.ca/
---
Message Handling with Boolean Algebra
Message reception and dispatch is something common to many codebases. And deep down, we know that Boolean algebra underlies everything we do. But we seldom give it a second thought, or if we do, we probably dismiss it as trivial; something we learned in college and quickly outgrew.
This talk shows the unreasonable effectiveness of going back to basics and really understanding and unlocking the power of Boolean algebra in the design of a message handling library. We'll talk about separating message layout and semantics, how to match against messages for dispatch, and particularly how to compose and simplify constraints at compile time, in order to do the least at runtime. We'll also introduce Boolean implication and see a non-obvious application which is key to a generic approach. Finally we'll see how message matchers can be generically transformed using compile-time information, allowing complete flexibility of expression and maximum runtime performance.
---
Slides: github.com/CppNorth/CppNorth_Slides/blob/main/2024/Ben%20Deane/Message%20Handling.pdf
Sponsored by:
think-cell: www.think-cell.com/cppnorth
JetBrains: www.jetbrains.com/
---
Ben Deane
Principal Engineer, Intel
Ben has been programming in C++ for this whole millennium. He spent just over 20 years in the games industry working for companies like EA and Blizzard; many of the games he worked on used to be fondly remembered but now he's accepted that they are probably mostly forgotten. After getting more interested in modern C++, in the teens he started giving internal company talks and then talks at various conferences, spreading ideas about types, algorithms and declarative and functional techniques.
In 2018 he left the games industry and worked in finance for a short spell, writing high-frequency trading platforms using the most modern C++ that compilers could support. Now he is a Principal Engineer at Intel where he puts monads inside your CPU.
---
CppNorth is an annual C++ conference held in Toronto, Canada.
- Annual CppNorth C++ conference: cppnorth.ca/
- CppNorth Twitter: cppnorth
---
UA-cam Videos Edited by
Alfio Foti
mulliganfilm@gmail.com
(416) 710 3994
#cpp​ #cppnorth​ #programming​
Переглядів: 10

Відео

How Designing Carbon C++ Interop Taught me About C++ Variadics & Bound Members - Chandler Carruth
Переглядів 33920 годин тому
cppnorth.ca/ How Designing Carbon C Interop Taught me About C Variadics & Bound Members C has some amazing and powerful language features, but they can be difficult to understand. Moving past a basic understanding of a feature and common patterns of use requires a deep understanding of the underlying language design so that you can model how it works and how to effectively use it. But how do yo...
Save Time, Space & a Little Sanity With std::function_ref - David Ledger
Переглядів 86622 години тому
cppnorth.ca/ Save Time, Space & a Little Sanity With std::function_ref Ever found a codebase full of function pointers and thought, there must be a better way? You found that better way, introduced std::function and now have a horrific performance regression? Performance problems are perfectly normal, and std::function_ref is here to help.std::function_ref is a vocabulary type that does not thr...
Mitigating the Intellectual Anxiety in Learning C++ - Dennis Onyeka, Emmanuel Nyarko
Переглядів 211День тому
cppnorth.ca/ Mitigating the Intellectual Anxiety in Learning C Learning a new programming language can be a heinous task, especially when faced with biases and myths surrounding the language. In this speech, we will discuss how to overcome biases and break down the barriers to learning a new programming language using technical terms and examples. In the context of programming languages, we wil...
... + CTAD + NTTP = 🤩 - Miro Knejp
Переглядів 248День тому
cppnorth.ca/ ... CTAD NTTP = 🤩 C is a language of many features and new keep being added over time. Rarely does any individual addition have a significant impact on how we write code, but when put together they can enable game-changing expressiveness. In this session we look at how the wombo combo of variadic templates, class template argument deduction (CTAD), and non-type template parameters ...
More Ranges Please - Roi Barkan
Переглядів 284День тому
cppnorth.ca/ More Ranges Please Ranges are one of the major additions of C 20, in which our main abstraction for sequences shifted from iterator-pairs into full fledged concepts, allowing better composability, expressibility and safety when working with bounded and even unbounded one dimensional sequences of data. The fluent use of the pipe-operator gave us power to write complex functional-sty...
Uplifting Your Career as a Youth in Tech - Sohaila Ali
Переглядів 108День тому
cppnorth.ca/ Uplifting Your Career as a Youth in Tech In this engaging talk, I will be discovering my journey into tech as a teenager, and share some advice for starting your career as a fellow teenager. Slides: github.com/CppNorth/CppNorth_Slides/blob/main/2024/Sohaila Ali/Cpp North Conf '24 Talk - Sohaila Ali.pdf Sponsored by: think-cell: www.think-cell.com/cppnorth JetBrains: www.jetbrains.c...
Why Modules?: It's not about build time - Steve Downey
Переглядів 516День тому
cppnorth.ca/ Why Modules?: It's not about build time C Named Modules are not about build optimization, although that was an important design consideration. Modules are about controlling visibility and access to names and definitions at a fine-grained level. This talk will show how to use the various features of modules and the kinds of module units to provide access to the features of your libr...
Practical Tips for Safer C++ - Tristan Brindle
Переглядів 375День тому
cppnorth.ca/ Practical Tips for Safer C Everybody wants to write safe, efficient, bug-free code, but C doesn't always make it easy! In this talk, we'll look at some common safety problems that can occur in everyday C code and offer practical advice and suggestions for detecting and avoiding them. While C isn't going to become "a safe language" any time soon, we can certainly make it safer for e...
Beginner's Mind, Expert's Mind - Dawid Zalewski
Переглядів 383День тому
cppnorth.ca/ Beginner's Mind, Expert's Mind How We Think About, Read, Write, and Learn to Code We are all born with the innate ability to count and to learn languages. Sadly, the same cannot be said for programming. What's more, neither linguistic nor math prowess seem to translate into coding skills. Similarly, just because you are an expert in C concurrency doesn't mean you won't have a hard ...
C++ Insights: Peek behind the curtains of your C++ compiler - Andreas Fertig
Переглядів 565День тому
cppnorth.ca/ C Insights: Peek behind the curtains of your C compiler C is not an easy language. While its intention, especially with the new Standards since C 11, is to shift more work from the developer to the compiler, this is sometimes perceived as opaque. Knowing what a statement does is vital not only in embedded software development. It is also essential while teaching C when questions co...
Safe Static Initialisation & Clean Up in Libraries - Ashley Roll
Переглядів 300День тому
cppnorth.ca/ Safe Static Initialisation & Clean Up in Libraries - Ashley Roll Static initialization is utilized to ensure that values are constructed before main(), making them available for use immediately and allowing important prerequisites to be established. However, the initialization of these values is more complex than it first appears. Statically linked or dynamically loaded libraries a...
Think Parallel: Scans - Bryce Adelstein Lelbach
Переглядів 4752 дні тому
cppnorth.ca/ Think Parallel: Scans By default, we think sequentially. Parallelism and asynchrony are often seen as challenging and complex. Tools to be used sparingly and cautiously, and only by experts. But we must shatter these assumptions, for today, we live in a parallel world. Almost every hardware platform is parallel, from the smallest embedded devices to the largest supercomputers. We m...
Improving Your Team(work) - Callum Piper
Переглядів 12514 днів тому
cppnorth.ca/ Improving Your Team(work) Throughout our careers, we will have the opportunity to work on many different teams and many different projects. We may sometimes work on a team that’s enjoyable, but isn't delivering too much. Other times, we might work on a team that delivers, but is no fun. If we’re really unlucky, we can end up on a team that doesn’t deliver and isn’t enjoyable. But o...
Testability and API Design - John Pavan, Aram Chunk, Lukas Zhao
Переглядів 20314 днів тому
cppnorth.ca/ Testability and API Design Good code must be both testable by its developers and usable in application test drivers and integration tests. We will explore and recommend approaches for designing APIs that result in both easily testable code and convenient interfaces for test drivers and integration tests. We will discuss specific techniques, simplified versions of examples from popu...
Building a C++/JS Browser for the Financial Markets - Paul Williams
Переглядів 1,7 тис.14 днів тому
Building a C /JS Browser for the Financial Markets - Paul Williams
Software Engineering Completeness - Peter Muldoon
Переглядів 34714 днів тому
Software Engineering Completeness - Peter Muldoon
The Shoulders We Stand On - Furkan Uzumcu, Quinn Hou
Переглядів 24414 днів тому
The Shoulders We Stand On - Furkan Uzumcu, Quinn Hou
C++ is a Metacompiler - Daniel Nikpayuk
Переглядів 69214 днів тому
C is a Metacompiler - Daniel Nikpayuk
C++ Reflection: Back on Track - David Olsen
Переглядів 1,1 тис.21 день тому
C Reflection: Back on Track - David Olsen
CppNorth 2024 Venue To Hotel
Переглядів 1864 місяці тому
CppNorth 2024 Venue To Hotel
Lightning Talk: Type-safe Dictionaries - Vincent Tourangeau - CppNorth 2023
Переглядів 913Рік тому
Lightning Talk: Type-safe Dictionaries - Vincent Tourangeau - CppNorth 2023
Lightning Talk: The Quest for Shorter Functions - Diana Ojeda Aristizabal - CppNorth 2023
Переглядів 902Рік тому
Lightning Talk: The Quest for Shorter Functions - Diana Ojeda Aristizabal - CppNorth 2023
Lightning Talk: FM Demodulation with RTL-SDR - Doug Hoyte - CppNorth 2023
Переглядів 516Рік тому
Lightning Talk: FM Demodulation with RTL-SDR - Doug Hoyte - CppNorth 2023
Lightning Talk: Learning Curves - Miro Knejp - CppNorth 2023
Переглядів 1,1 тис.Рік тому
Lightning Talk: Learning Curves - Miro Knejp - CppNorth 2023
Lightning Talk: Your Hands Are Very Important - Jeremy Mark Tubongbanua - CppNorth 2023
Переглядів 330Рік тому
Lightning Talk: Your Hands Are Very Important - Jeremy Mark Tubongbanua - CppNorth 2023
Lightning Talk: sizeof((std::variant( double, char[10])) - Olivia Wasalski - CppNorth 2023
Переглядів 1,2 тис.Рік тому
Lightning Talk: sizeof((std::variant( double, char[10])) - Olivia Wasalski - CppNorth 2023
Lightning Talk: Decoupling Test & Simulation Code from Production Code - Rafael Ottmann CppNorth 23
Переглядів 347Рік тому
Lightning Talk: Decoupling Test & Simulation Code from Production Code - Rafael Ottmann CppNorth 23
Lightning Talk: Keys to Conscious Creation - Intersection of Piano Artistry & Ethical AI - Emily Lai
Переглядів 225Рік тому
Lightning Talk: Keys to Conscious Creation - Intersection of Piano Artistry & Ethical AI - Emily Lai
Lightning Talk: Virtual Functions Are Not Slow - Rud Merriam - CppNorth 2023
Переглядів 1,3 тис.Рік тому
Lightning Talk: Virtual Functions Are Not Slow - Rud Merriam - CppNorth 2023

КОМЕНТАРІ

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

    The question is it will take decades to make shift all legacy from C++ to Carbon

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

    30:00 Combinator = Composition Pattern

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

    thank you!

  • @NosebergEatzbugsVonShekelstein
    @NosebergEatzbugsVonShekelstein 3 місяці тому

    Pointless addition to the language. Violates the rules of structured programming and enabled spaghetti code.

  • @Dexterdevloper
    @Dexterdevloper 4 місяці тому

    when will it be ready for production usage?.

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

      Experimental V0.1 2025, prod-ready after 2027

  • @avimehenwal
    @avimehenwal 5 місяців тому

    Nice intro talk. Now I am interested in looking into Nix

  • @iverbrnstad791
    @iverbrnstad791 5 місяців тому

    I think it is worth giving some mention that on the front of static typing Rust actually is meaningfully stronger than C++, as C++ number types internally behave like a dynamic typed language, which can turn into surprises.

  • @alejandroviciedo8817
    @alejandroviciedo8817 5 місяців тому

    Exactly what I was looking for Thanks 🙏

  • @amarboldbatzorig7313
    @amarboldbatzorig7313 6 місяців тому

    Super informative

  • @shoulderstack5527
    @shoulderstack5527 6 місяців тому

    In the future they will look back at the last 50 years of computer programming and think of it as the Dark Ages: a time of confusion, superstition, tribalism and madness. This is not a joke or a criticism of the lecture. As an industry we are constantly making up new ways of telling ourselves we are in control, but in reality it is a Tower of Babel.

  • @obinnaokafor6252
    @obinnaokafor6252 7 місяців тому

    Amazing presentation ❤

  • @aMulliganStew
    @aMulliganStew 7 місяців тому

    With all humility, not wishing to imply that I have his greatness (or indeed anything more than glints of occasional competence)... Late in his career, Neil Peart took drum lessons -- in jazz. So it might also be for me, coming from a procedural/object-based background (heavy on the former), as I take the plunge into functional /combinatorial. I find it all very intriguing. Thanks to Conor and everyone for the talks.

  • @Mark-zk7uj
    @Mark-zk7uj 8 місяців тому

    I don't like C++ but I do like listening to Kate Gregory.

  • @AndreiGeorgescu-j9p
    @AndreiGeorgescu-j9p 8 місяців тому

    That fromEnum solution is absolutely awful and haskell does have a count function... Not like you couldn't have defined it yourself

  • @AndreiGeorgescu-j9p
    @AndreiGeorgescu-j9p 8 місяців тому

    The definition of pure function and distinction isn't really correct. A combinator is a pure function that is not a closure, that's it.

  • @1234567martymcfly
    @1234567martymcfly 8 місяців тому

    Really good talk!

  • @holonaut
    @holonaut 9 місяців тому

    00:00:12 Rust foundation be like: "What did you just say??? I haven't heard you ask for permission"

  • @vldthdrgn
    @vldthdrgn 9 місяців тому

    Conor is easily one of the best programming speakers! Combinatorial logic and array programming are such interesting subjects. Keep up the great work!

  • @vldthdrgn
    @vldthdrgn 9 місяців тому

    Amazing!

  • @blacky7801
    @blacky7801 9 місяців тому

    What about any of this is "experimental"? They just took elements from the most popular langauges and put them into their langauge. Its not even that they took parts from several radically different langauges and the combination of those is a unique product, its just a subset of other popular languages. They only call it "experimental" as to qualify their claim of being a successor to Cpp, as to not sound as arrogant.

  • @about2mount
    @about2mount 9 місяців тому

    Same as the new Zig Language you're using the massive LLVM Libraries. An LLVM-only build requires anywhere from 1 to 3 GB of space on any machine. A full build of LLVM and Clang will need around 15 to 20 GB of disk space. The exact space requirements will vary by system but damn. They claim it's so large because of all the debugging information and the fact that the libraries are statically linked into multiple tools. I call that "Organized Despair". No Offence, however just before using Carbon for your own Application Builds, your using a Program that is ten times larger than a Linux Ubuntu OS just to achieve it. You would be much better off to have gone with a Python Like Approach using C++ as a base language with an Interpreter instead right?

  • @anon_y_mousse
    @anon_y_mousse 10 місяців тому

    I don't know if he's trying to sensationalize this talk or if he's received brain damage in the past couple of years, but there are several "points" he makes that are just wrong. For starters, outside of niche mathematical uses, overflow isn't a problem, and in those instances where it could be a problem you can detect overflow yourself before causing it and thus prevent even the possibility of ill effects. Part of the problem I see relating to it is people not checking user input, and if you're not checking user input then you probably shouldn't be a programmer. As far as sorting floating point data, you can provide your own comparator if you don't like what the default does, but there's nothing in the standard preventing you from calling std::sort() on such arrays. And I'm going to skip all the rest to say that no language should have an unsafe keyword. That's the kind of garbage that gives newbies a false sense of security which causes even worse subtle bugs to crop up. No programming language should constrain programmers like that. Far too many new languages keep popping up that constrain you in ways that prevent valid use cases and try to push this propaganda that it's justified because it prevents bad programs, even though there are whole classes of problems that they do nothing to prevent and which can be far more pernicious than the classes of problems they do prevent. But ultimately, if you want to constrain code that scares you into "unsafe" sections, use a static analyzer, as there are many to pick from, including free and open source analyzers, and just add a comment around that code labeling it unsafe.

  • @0LoneTech
    @0LoneTech 10 місяців тому

    Futhark sample: let SumOfSquares a = map2 (\x i -> if length a % (i+1) == 0 then x*x else 0) a (indices a) |> reduce_comm (+) 0 This isn't point free but does use three different combinators. |> could be replaced by reordering with parenthesis, but the map-reduce array combinators are the expected way to handle arrays. The filter was avoided using a neutral element, because realizing the filtered list could cause multiple heavier passes.

  • @olafschluter706
    @olafschluter706 10 місяців тому

    Nice talk but wrong in so many ways that I am not interested to discuss. It its a very opinionated talk about what are the strength of C++. Lot's of love for auto but no mentioning what so ever for smart pointers, which are way more important to write sound code. And being standardised isn't really helping in writing good software. It is just helping in writing portable software. And it is somewhat dismissed by available compilers not implementing standards. Most of the time you need to figure out by experiment what your C++ compiler is able to do. Programming languages where there is only one compiler available, which is constructed by the people designing the language, set their standards by implementation. I prefer that way. I never was disappointed by a rust or swift compiler - but I found that I was very dependent on the specific version of gcc or clang to use C++ "standard" features. E.g. C++ has modules since C++20, but even setting your compiler standard to c++23 won't make it work with cmake, as the way to process modules and link to them is very compiler specific. As of now it isn't something to rely on for production code, at least not of production code supposed to be portable. If one goes into the list of supported C++ features of gcc or clang on the internet, one will find a mess. Standards do not help C++ as compiler vendors seem to adopt to them just as they feel like it.

  • @lorenzobolis5166
    @lorenzobolis5166 10 місяців тому

    8:40 they did not fix it in post

  • @bobweiram6321
    @bobweiram6321 10 місяців тому

    No one got the joke, 1420 is not 420. 20:55

  • @rocknroooollllll
    @rocknroooollllll 10 місяців тому

    I simply cannot believe that people are using anything other than C linkage on the API boundary. Using C++ types just leads to eventual misery, and is holding the language back because now nobody wants to break ABI.

  • @ericzenk4404
    @ericzenk4404 10 місяців тому

    Wonderful talk. I completely agree on using asserts and also making sure they don't change algo complexity. For developer time, it is one of the most efficient ways to (partially) verify correctness.

  • @georganatoly6646
    @georganatoly6646 10 місяців тому

    life after c++, it's fun to dream, although I'd be happy if there was only C and assembly, have we ever really needed anything else?

  • @assonancex
    @assonancex 10 місяців тому

    superb talk !!

  • @flippert0
    @flippert0 11 місяців тому

    34:55 most important statement of the whole talk? Because so much other stuff follows from this seemingly innocuous statement.

  • @MrAbrazildo
    @MrAbrazildo 11 місяців тому

    12:00, *1888. 15:34, what?! Do you know any other kind of software they are willing to pay millions? 38:30, to map true/false keeping their positions/indexes. If that's not required, std::partition puts all trues at the beginning, returning a pointer to where they finish and to where the falses start. And std::stable_partition, despite obviously not keeping their indexes, keep their positions related to each other, at each group. 56:00, auto sum_of_squares (std::vector<int> nums) {return std::accumulate (nums.begin(), nums.end(), 0, [](auto x, auto i) {return !(nums.size() % i)*x*x;});}

  • @xealit
    @xealit 11 місяців тому

    Good clear points. On another hand, it's a bit depressing how 20 years of the language went into just getting rid of redundant typing in C++03 for loops with a bunch of new concepts and new syntax. And it skips all the gotchas along the way.

  • @Heater-v1.0.0
    @Heater-v1.0.0 11 місяців тому

    So my take away from all this is that C++ has an ugly syntax, C++ is overly complex, C++ is not safe in anyway. Likely none of this can be fixed. Makes me feel OK that after decades of using C++ I gave up in disgust a few years ago and moved on. It's good to know smarter people than me feel the same.

  • @Yupppi
    @Yupppi 11 місяців тому

    Hoekstra family sounds like one of the scariest families. Three children who can APL and work with data and numbers.

  • @RajaHarinath
    @RajaHarinath 11 місяців тому

    Is it "undefined behaviour" to use a cursor from one sequence onto another sequence? e.g., `flux::inc(seq2, flux::first(seq1))`

  • @thestarinthesky_
    @thestarinthesky_ 11 місяців тому

    Great explanations. Thank you for sharing❤

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

    At 22:00 I have to question the sanity of a person who writes (or rather generates) such code and calls it a feature of a modern language. If you can't do it in C, you're simply doing it wrong 😉

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

    I owe my career to "this should work". As an autodidactic programmer, everything I've done in my career started out as something I didn't know how to do, but believed it could be done. If I ever really doubted it, I couldn't have accomplished it.

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

    The people asking advice is a fascinating social process. People have all kinds of intuition based reasons they choose who to ask for help. They rarely ask from the person they know is just knowledgeable and good at something. They rarely listen to the person that can build their answer based on known facts and conclusions, mechanics and processes, and is willing to mention the reasons why they give the advice. They often ask from the person others ask from or who has some status. Like a social media influencer. And the shorter and easier the answer, the more likely they are to listen and take it. Like they might know a person who's really into cars and someone who's into psychology, and they ask the person who's into psychology about their car (because that person has a car too). Maybe it's because they expect not to understand the car enthusiasts answer or think the answer's gonna be too in-depth, the car enthusiast might educate them on what's the problem and how to deal with it instead of telling them just to get part X from the local car shop. And sometimes there's a couple of people who are present hearing the question and give their two cents, and the person asking takes the advice that's not reasoned, just thrown out there, and the other people think "well that's not gonna end up in success unfortunately" and see it unfold a bit later. But the social processes decide that had to happen. Or someone gives advice and a reason, but someone is set to do it one way, ends up failing and following the advice, sometimes with "should've listened, you were right".

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

    Yes, with a lot of hoops and tricks you can start reimplementing features of Rust in your C++ code. Or you can just do the logical step and switch to Rust. What the industy is doing anywhay.

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

    So many words... I think it's pretty clear, that it's time to switch to Rust. That is what everyone is doing.

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

    I'm starting to think Sean Parent is like this uncle of C++. Cool and knows all the stuff and is happy to teach. Honestly his points are good. A lot of languages are popping up that are successfully fixing a lot of C/C++ issues. Like the readability of the library and having some sort of teaching tools and exercises to learn to use the language. Or just good material on using the language over reading templated documentation that makes no sense. Languages like Rust and Zig, much, much faster, fixing safety/memory issues, having package managers, having learning tools, brilliant error messages from the compiler. Given that Rust has the con that C++ doesn't: getting the code to actually run is next to impossible, because it holds you responsible of doing it until it's right.

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

    Quite interesting to listen. Very neat speech. Thanks!

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

    :o 🎉

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

    Good presentation!!!

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

    Great talk, thanks! Thanks to your videos I discovered array-stack languages. Here is my uiua version of the pos-neg count. I'm starting to find this language (family) really beautiful. Again thank you! ↥∩/+⊃<>0

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

    41:33 wouldn’t overloading the close_session function just reintroduce the problem which we are trying to solve by using enum classes? Before using enum-> pass the wrong value, underlying type is int-> wrong item gets erased. After using enum + overload -> pass the wrong value, overloaded function gets called, wrong item gets erased, unless we have different implementations for each of the overloaded functions

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

    Thank you for a great talk :)

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

    First solution is a boxing - it's working, for sure, but it have costs, isn't it? Or the compiler can somehow strip away everything except the wrapped string inside the struct?🤔