Keynote: Delimited Continuations, Demystified by Alexis King | Lambda Days 2023

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

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

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

    I think this is the first time I've fully grasped delimited continuations. Thanks!

  • @jpratt8676
    @jpratt8676 5 หลายเดือนก่อน +7

    You know its likely to be a good talk when Simon Payton Jones is asking questions

    • @sirnawaz
      @sirnawaz 2 หลายเดือนก่อน

      Timestamp?

    • @bradgaragan4848
      @bradgaragan4848 2 หลายเดือนก่อน +1

      @@sirnawaz 49:19

  • @laughingvampire7555
    @laughingvampire7555 7 หลายเดือนก่อน +2

    the best way to understand continuations is to learn continuation passing style, you can do continuations in any program that supports higher order functions, the problem is that people is scared away of CPS as something the compiler should do, then they get frustrated because they don't understand what the compiler is doing.

  • @laughingvampire7555
    @laughingvampire7555 7 หลายเดือนก่อน

    don't say that is boring, say that is a simple mechanism that allows for powerful flow control

  • @LDRAGONFLYL
    @LDRAGONFLYL 6 หลายเดือนก่อน +1

    44:17 people have CoW-ed memory pages when they fork() since time immemorial... Why not map those memory as CoW instead of copying pessimistically?

    • @jpratt8676
      @jpratt8676 5 หลายเดือนก่อน

      That appears to make a lot of sense, but perhaps they almost always get mutated directly after?

  • @LDRAGONFLYL
    @LDRAGONFLYL 6 หลายเดือนก่อน

    59:10 because other programming languages are too deep into an unhealthy relationship with dependency injection, they can no longer conceptualize the beauty of proper one-shot delimited continuation 😅

  • @Verrisin
    @Verrisin 6 หลายเดือนก่อน

    ... so it is just like the do sugar for monads ... just more versatile and normal ...

    • @jpratt8676
      @jpratt8676 5 หลายเดือนก่อน +1

      A lot more, but they also have performance implications that can be very helpful!

    • @nanman_chief
      @nanman_chief 4 หลายเดือนก่อน +1

      Effect handlers, monadic reflection, and delimited continuations have equivalent expressivity (and macro-express each other) when types are not taken into consideration. If type preservation is considered, effect handlers lose type information when translated to delimited continuations or monadic reflections. This is the only difference between them.

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

    This sounds a lot like the handlers in Unison

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

      They are implemented with delimited continuations I think.

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

      Yep, that is exactly the kind of effect system that this is intended for building

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

    very clear explanation of a complex topic, the idea doesn't seem appealing tho. complicates the programmers model of program execution and messes with simple controll flow. hard pass for me.
    Edit: Thinking about it a bit more makes me more positive: They are an excellent notation to describe the wack control flow that language features like exceptions or exiting have.

    • @poscat0x04
      @poscat0x04 11 หลายเดือนก่อน +6

      The point is that it is powerful enough to implement many features that are usually language level, such as generators, coroutines and algebraic effects.

    • @blacky7801
      @blacky7801 11 หลายเดือนก่อน +1

      ​@@poscat0x04
      I really like this Dijkstra quote: "Our intellectual powers are rather geared to master static relations and our powers to visualize processes evolving in time are relatively poorly developed. For that reason we should do (as wise programmers aware of our limitations) our utmost to shorten the conceptual gap between the static program and the dynamic process, to make the correspondence between the program (spread out in text space) and the process (spread out in time) as trivial as possible."
      I don't disagree that they are a very powerful technique, I just think that the sort of twisted evaluation that delimited continuations entail are far far away from its textual representation.

    • @poscat0x04
      @poscat0x04 11 หลายเดือนก่อน +6

      @@blacky7801 Honestly I'm not buying into this handwavy anti-abstraction nonsence, even if it's said from dijkstra (after all he didn't provide any reason behind this judgement). The contemporary philosophy on programming/software engineering is that programming is all about managing complexity, which is done through abstraction.

    • @blacky7801
      @blacky7801 11 หลายเดือนก่อน

      @@poscat0x04 I don't see where this quote is anti-abstraction at all?
      The article this quote is from is his famous "go to statement considered harmful" article in which he argues against the use of goto. He was a proponent of structured programming, a higher level of abstraction compared to the structureless programming that goto allows.
      The argument presented in the article is that go to makes tracking the progress of any process impossible. Tracking the progress of a function is of course vital to understanding its behaviour, as its part of the internal state. In a program consisting of only of assignment statements, it is easy to characterize the progress: by a single instruction pointer. In a program consisting of function calls, it is again easy to characterize the progress: by a callstack. Simple and predictable. However, in the case of a program containing goto statements it is impossible to reason about the progress of the process in the general case. Including it in a Language breaks the simple execution model present in structured programming.
      Thinking about it this way, adding delimited continuations to a language causes the same breaks to the simple reduction semantics. At any given step in the redduction it is impossible to determine the progress of it, as reduction rules containing delimited continuations can rewrite the past almost at will. There is no understanding the behaviour of a function if the continuation to be reduced can change under you feet at any moment. Delimited continuations are the opposite of managing complexity, they are introducing complexity in reduction where before there was simplicity.

    • @saltrocklamp199
      @saltrocklamp199 9 หลายเดือนก่อน +3

      I've seen it argued that "un-delimited" continuations (like in Scheme) are much worse, and that delimited continuations are a better language primitive. You might also be interested in algebraic effect handlers, which as far as I understand is basically statically-typed delimited continuation. See for example the new OCaml effect system, or the Koka research language.