SlideShare une entreprise Scribd logo
1  sur  21
Télécharger pour lire hors ligne
continuations in
                         fujohnwang
                            @Twitter
                              @weibo




Saturday, July 9, 2011
what’s continuation?

               Continuation capture the state of a
               computation(maybe to be invoked later).

                         Simple concept, but hard to get.

               first-class support in schema language




Saturday, July 9, 2011
know CPS first
               normal control flow structure

               control flow structure after cps




                            PS.	
  code	
  sample	
  borrowed	
  from	
  http://www.slideshare.net/openbala/continuations




Saturday, July 9, 2011
WHat’s the big deal?




Saturday, July 9, 2011
usage scenarios
               programming design pattern

               coroutine

               exception handling

               web frameworks

               backtracking



Saturday, July 9, 2011
observer pattern with
        continuation




Saturday, July 9, 2011
Coroutine?



               see the blog of jim mcbeatch




Saturday, July 9, 2011
Exception handling



               No sample code yet




Saturday, July 9, 2011
Web Framework
         with continuation support
               seaside / smalltalk

               cocoon / Java

                         http://cocoon.apache.org/2.1/userdocs/flow/continuations.html


               weblocks / common lisp

               wee / ruby

               ocsigen / ocaml

               more...
Saturday, July 9, 2011
Saturday, July 9, 2011
code pieces
     function calculator()
     {
       var a, b, operator;

       cocoon.sendPageAndWait("getA.html");
       a = cocoon.request.get("a");

       cocoon.sendPageAndWait("getB.html");
       b = cocoon.request.get("b");

       cocoon.sendPageAndWait("getOperator.html");
       operator = cocoon.request.get("op");

            try {
              if (operator == "plus")
                 cocoon.sendPage("result.html", {result: a + b});
              else if (operator == "minus")
                 cocoon.sendPage("result.html", {result: a - b});
              else if (operator == "multiply")
                 cocoon.sendPage("result.html", {result: a * b});
              else if (operator == "divide")
                 cocoon.sendPage("result.html", {result: a / b});
              else
                 cocoon.sendPage("invalidOperator.html", {operator: operator});
            }
            catch (exception) {
              cocoon.sendPage("error.html", {message: "Operation failed: " + exception.toString
         ()});
            }
Saturday,} 9, 2011
         July
Continuation types

               full continuation(aka. first-class cont.)

               delimited continuation        (aka. partial, composable cont.)


                         write async code as sequence one

                         mix cps code and normal code seamlessly




Saturday, July 9, 2011
What DC looks like?
                                                                             reset	
  {
             reset	
  {
                                                                             	
  	
  	
  	
  println(1)
             	
  	
  	
  	
  println(1)
                                                                             	
  	
  	
  	
  shift	
  {	
  cont	
  =>
             	
  	
  	
  	
  shift	
  {	
  cont	
  =>	
  }
                                                                             	
  	
  	
  	
  	
  	
  	
  	
  println(2)
             	
  	
  	
  	
  println(2)
                                                                             	
  	
  	
  	
  }
             }
                                                                             	
  	
  	
  	
  println(3)
             //prints:	
  1
                                                                             }
                                                                             //prints:	
  1	
  2

                                                                             reset	
  {
                                                                             	
  	
  	
  	
  println(1)
     	
   def	
  is123(n:Int):Boolean	
  =	
  {                              	
  	
  	
  	
  shift	
  {	
  cont	
  =>
     	
  	
  	
   	
   reset	
  {                                            	
  	
  	
  	
  	
  	
  	
  	
  cont()
     	
  	
  	
  	
  	
   	
   shift	
  {	
  k	
  :	
  (Int=>String)	
  =>   	
  	
  	
  	
  	
  	
  	
  	
  println(2)
     	
  	
  	
  	
  	
  	
  	
  	
   	
   (k(n)	
  ==	
  "123")             	
  	
  	
  	
  }
     	
  	
  	
  	
  	
   	
   }.toString                                    	
  	
  	
  	
  println(3)
     	
  	
  	
   	
   }                                                     }
     	
   }                                                                  //prints:	
  1	
  3	
  2




Saturday, July 9, 2011
first glance with dc
               reset and shift

                         reset sets up the boundary of dc(‘s cps)

                         shift captures the continuation

               Result types

                         yield

                         return


Saturday, July 9, 2011
puzzle about
      yield and return




Saturday, July 9, 2011
scala cont features
               compiler plugin + Library

                         compiler plugin does cps transformation


                         library supports control structures and directives


               serializable (can be saved, distribute sys...)

                         see swarm?!

               Others?


Saturday, July 9, 2011
available softwares
               swarm

               scalaflow

               Akka’s DataFlow Concurrency library

               nio actor implementation for akka

               nioserver




Saturday, July 9, 2011
What I want to do with it

               coroutine

               combine with java nio

               resource-efficient minimally-threaded
               networking layer framework

               reduce hw cost finally



Saturday, July 9, 2011
Questions?




Saturday, July 9, 2011
References
               http://www.scala-lang.org/node/2096

               http://okmij.org/ftp/continuations/Continuations.html

               http://jim-mcbeath.blogspot.com/2010/08/delimited-continuations.html

               http://lamp.epfl.ch/~rompf/continuations-icfp09.pdf
               http://okmij.org/ftp/continuations/index.html

               http://suereth.blogspot.com/2010/03/how-you-should-think-about-delimited.html

               http://dcsobral.blogspot.com/2009/07/delimited-continuations-explained-in.html

               http://blog.richdougherty.com/2009/02/delimited-continuations-in-scala_24.html

               http://en.wikipedia.org/wiki/Seaside_(software)

               http://en.wikipedia.org/wiki/Call-with-current-continuation

               http://community.schemewiki.org/?call-with-current-continuation-for-C-programmers

               http://community.schemewiki.org/?call-with-current-continuation

               http://en.wikipedia.org/wiki/Coroutine

               http://cocoon.apache.org/2.1/userdocs/flow/continuations.html

               https://github.com/rschildmeijer/loft


Saturday, July 9, 2011
Thanks




Saturday, July 9, 2011

Contenu connexe

Tendances

Introduction to Kotlin Language and its application to Android platform
Introduction to Kotlin Language and its application to Android platformIntroduction to Kotlin Language and its application to Android platform
Introduction to Kotlin Language and its application to Android platformEastBanc Tachnologies
 
Mirah Talk for Boulder Ruby Group
Mirah Talk for Boulder Ruby GroupMirah Talk for Boulder Ruby Group
Mirah Talk for Boulder Ruby Groupbaroquebobcat
 
Frege - consequently functional programming for the JVM
Frege - consequently functional programming for the JVMFrege - consequently functional programming for the JVM
Frege - consequently functional programming for the JVMDierk König
 
Messages from Perl
Messages from PerlMessages from Perl
Messages from PerlHanae Aoki
 
Polyglot Programming @ Jax.de 2010
Polyglot Programming @ Jax.de 2010Polyglot Programming @ Jax.de 2010
Polyglot Programming @ Jax.de 2010Andres Almiray
 
Kotlin, smarter development for the jvm
Kotlin, smarter development for the jvmKotlin, smarter development for the jvm
Kotlin, smarter development for the jvmArnaud Giuliani
 
What’s new in Kotlin?
What’s new in Kotlin?What’s new in Kotlin?
What’s new in Kotlin?Squareboat
 
FregeFX - JavaFX with Frege, a Haskell for the JVM
FregeFX - JavaFX with Frege, a Haskell for the JVMFregeFX - JavaFX with Frege, a Haskell for the JVM
FregeFX - JavaFX with Frege, a Haskell for the JVMDierk König
 
Douglas Crockford Presentation Goodparts
Douglas Crockford Presentation GoodpartsDouglas Crockford Presentation Goodparts
Douglas Crockford Presentation GoodpartsAjax Experience 2009
 
Connecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyConnecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyNick Sieger
 
K is for Kotlin
K is for KotlinK is for Kotlin
K is for KotlinTechMagic
 
Open Source Compiler Construction for the JVM
Open Source Compiler Construction for the JVMOpen Source Compiler Construction for the JVM
Open Source Compiler Construction for the JVMTom Lee
 
Kotlin for Android Development
Kotlin for Android DevelopmentKotlin for Android Development
Kotlin for Android DevelopmentSpeck&Tech
 
Functional programming with Java 8
Functional programming with Java 8Functional programming with Java 8
Functional programming with Java 8LivePerson
 
Functional programming in scala
Functional programming in scalaFunctional programming in scala
Functional programming in scalaStratio
 
Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojureAbbas Raza
 

Tendances (20)

Introduction to Kotlin Language and its application to Android platform
Introduction to Kotlin Language and its application to Android platformIntroduction to Kotlin Language and its application to Android platform
Introduction to Kotlin Language and its application to Android platform
 
Mirah Talk for Boulder Ruby Group
Mirah Talk for Boulder Ruby GroupMirah Talk for Boulder Ruby Group
Mirah Talk for Boulder Ruby Group
 
Kotlin - Better Java
Kotlin - Better JavaKotlin - Better Java
Kotlin - Better Java
 
Python master class 2
Python master class 2Python master class 2
Python master class 2
 
Frege - consequently functional programming for the JVM
Frege - consequently functional programming for the JVMFrege - consequently functional programming for the JVM
Frege - consequently functional programming for the JVM
 
Messages from Perl
Messages from PerlMessages from Perl
Messages from Perl
 
Polyglot Programming @ Jax.de 2010
Polyglot Programming @ Jax.de 2010Polyglot Programming @ Jax.de 2010
Polyglot Programming @ Jax.de 2010
 
Kotlin, smarter development for the jvm
Kotlin, smarter development for the jvmKotlin, smarter development for the jvm
Kotlin, smarter development for the jvm
 
What’s new in Kotlin?
What’s new in Kotlin?What’s new in Kotlin?
What’s new in Kotlin?
 
FregeFX - JavaFX with Frege, a Haskell for the JVM
FregeFX - JavaFX with Frege, a Haskell for the JVMFregeFX - JavaFX with Frege, a Haskell for the JVM
FregeFX - JavaFX with Frege, a Haskell for the JVM
 
Seeking Clojure
Seeking ClojureSeeking Clojure
Seeking Clojure
 
Douglas Crockford Presentation Goodparts
Douglas Crockford Presentation GoodpartsDouglas Crockford Presentation Goodparts
Douglas Crockford Presentation Goodparts
 
Rjb
RjbRjb
Rjb
 
Connecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyConnecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRuby
 
K is for Kotlin
K is for KotlinK is for Kotlin
K is for Kotlin
 
Open Source Compiler Construction for the JVM
Open Source Compiler Construction for the JVMOpen Source Compiler Construction for the JVM
Open Source Compiler Construction for the JVM
 
Kotlin for Android Development
Kotlin for Android DevelopmentKotlin for Android Development
Kotlin for Android Development
 
Functional programming with Java 8
Functional programming with Java 8Functional programming with Java 8
Functional programming with Java 8
 
Functional programming in scala
Functional programming in scalaFunctional programming in scala
Functional programming in scala
 
Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojure
 

En vedette

Gold investment types introduction
Gold investment types introductionGold investment types introduction
Gold investment types introductionFuqiang Wang
 
Scala funbyexample
Scala funbyexampleScala funbyexample
Scala funbyexampleFuqiang Wang
 
Seed2016 - 개미수열 한주영 (annotated)
Seed2016 - 개미수열 한주영 (annotated)Seed2016 - 개미수열 한주영 (annotated)
Seed2016 - 개미수열 한주영 (annotated)Jooyung Han
 
挖财的互联网金融技术实践与探索@upyun opentalk
挖财的互联网金融技术实践与探索@upyun opentalk挖财的互联网金融技术实践与探索@upyun opentalk
挖财的互联网金融技术实践与探索@upyun opentalkFuqiang Wang
 
Proof and Emacs
Proof and EmacsProof and Emacs
Proof and Emacsdico_leque
 
モナドをつくろう
モナドをつくろうモナドをつくろう
モナドをつくろうdico_leque
 
Architecture patterns and practices
Architecture patterns and practicesArchitecture patterns and practices
Architecture patterns and practicesFuqiang Wang
 
More Than Java Concurrency
More Than Java ConcurrencyMore Than Java Concurrency
More Than Java ConcurrencyFuqiang Wang
 
Zookeeper In Simple Words
Zookeeper In Simple WordsZookeeper In Simple Words
Zookeeper In Simple WordsFuqiang Wang
 
JVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in KotlinJVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in KotlinAndrey Breslav
 
A Brief Intro to Scala
A Brief Intro to ScalaA Brief Intro to Scala
A Brief Intro to ScalaTim Underwood
 

En vedette (13)

Gold investment types introduction
Gold investment types introductionGold investment types introduction
Gold investment types introduction
 
Scala funbyexample
Scala funbyexampleScala funbyexample
Scala funbyexample
 
Seed2016 - 개미수열 한주영 (annotated)
Seed2016 - 개미수열 한주영 (annotated)Seed2016 - 개미수열 한주영 (annotated)
Seed2016 - 개미수열 한주영 (annotated)
 
Kafka简介
Kafka简介Kafka简介
Kafka简介
 
挖财的互联网金融技术实践与探索@upyun opentalk
挖财的互联网金融技术实践与探索@upyun opentalk挖财的互联网金融技术实践与探索@upyun opentalk
挖财的互联网金融技术实践与探索@upyun opentalk
 
Proof and Emacs
Proof and EmacsProof and Emacs
Proof and Emacs
 
モナドをつくろう
モナドをつくろうモナドをつくろう
モナドをつくろう
 
Architecture patterns and practices
Architecture patterns and practicesArchitecture patterns and practices
Architecture patterns and practices
 
SBT Made Simple
SBT Made SimpleSBT Made Simple
SBT Made Simple
 
More Than Java Concurrency
More Than Java ConcurrencyMore Than Java Concurrency
More Than Java Concurrency
 
Zookeeper In Simple Words
Zookeeper In Simple WordsZookeeper In Simple Words
Zookeeper In Simple Words
 
JVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in KotlinJVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in Kotlin
 
A Brief Intro to Scala
A Brief Intro to ScalaA Brief Intro to Scala
A Brief Intro to Scala
 

Similaire à Continuations in scala (incomplete version)

The State of Lightweight Threads for the JVM
The State of Lightweight Threads for the JVMThe State of Lightweight Threads for the JVM
The State of Lightweight Threads for the JVMVolkan Yazıcı
 
Stackless Python In Eve
Stackless Python In EveStackless Python In Eve
Stackless Python In Evel xf
 
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017 Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017 Codemotion
 
Clojure 1.1 And Beyond
Clojure 1.1 And BeyondClojure 1.1 And Beyond
Clojure 1.1 And BeyondMike Fogus
 
Cray XT Porting, Scaling, and Optimization Best Practices
Cray XT Porting, Scaling, and Optimization Best PracticesCray XT Porting, Scaling, and Optimization Best Practices
Cray XT Porting, Scaling, and Optimization Best PracticesJeff Larkin
 
Threaded Programming
Threaded ProgrammingThreaded Programming
Threaded ProgrammingSri Prasanna
 
If You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are WrongIf You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are WrongMario Fusco
 
Stackless Python In Eve
Stackless Python In EveStackless Python In Eve
Stackless Python In Eveguest91855c
 
Our challenge for Bulkload reliability improvement
Our challenge for Bulkload reliability  improvementOur challenge for Bulkload reliability  improvement
Our challenge for Bulkload reliability improvementSatoshi Akama
 
Developing Java Streaming Applications with Apache Storm
Developing Java Streaming Applications with Apache StormDeveloping Java Streaming Applications with Apache Storm
Developing Java Streaming Applications with Apache StormLester Martin
 
May2010 hex-core-opt
May2010 hex-core-optMay2010 hex-core-opt
May2010 hex-core-optJeff Larkin
 
From Java to Parellel Clojure - Clojure South 2019
From Java to Parellel Clojure - Clojure South 2019From Java to Parellel Clojure - Clojure South 2019
From Java to Parellel Clojure - Clojure South 2019Leonardo Borges
 
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...Francesco Casalegno
 
Scala is java8.next()
Scala is java8.next()Scala is java8.next()
Scala is java8.next()daewon jeong
 
Silicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsAzul Systems, Inc.
 
C++totural file
C++totural fileC++totural file
C++totural filehalaisumit
 
Clojure concurrency
Clojure concurrencyClojure concurrency
Clojure concurrencyAlex Navis
 
JavaScript Editions ES7, ES8 and ES9 vs V8
JavaScript Editions ES7, ES8 and ES9 vs V8JavaScript Editions ES7, ES8 and ES9 vs V8
JavaScript Editions ES7, ES8 and ES9 vs V8Rafael Casuso Romate
 

Similaire à Continuations in scala (incomplete version) (20)

The State of Lightweight Threads for the JVM
The State of Lightweight Threads for the JVMThe State of Lightweight Threads for the JVM
The State of Lightweight Threads for the JVM
 
Stackless Python In Eve
Stackless Python In EveStackless Python In Eve
Stackless Python In Eve
 
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017 Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
 
Clojure 1.1 And Beyond
Clojure 1.1 And BeyondClojure 1.1 And Beyond
Clojure 1.1 And Beyond
 
Cray XT Porting, Scaling, and Optimization Best Practices
Cray XT Porting, Scaling, and Optimization Best PracticesCray XT Porting, Scaling, and Optimization Best Practices
Cray XT Porting, Scaling, and Optimization Best Practices
 
Threaded Programming
Threaded ProgrammingThreaded Programming
Threaded Programming
 
If You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are WrongIf You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are Wrong
 
Stackless Python In Eve
Stackless Python In EveStackless Python In Eve
Stackless Python In Eve
 
Our challenge for Bulkload reliability improvement
Our challenge for Bulkload reliability  improvementOur challenge for Bulkload reliability  improvement
Our challenge for Bulkload reliability improvement
 
Developing Java Streaming Applications with Apache Storm
Developing Java Streaming Applications with Apache StormDeveloping Java Streaming Applications with Apache Storm
Developing Java Streaming Applications with Apache Storm
 
May2010 hex-core-opt
May2010 hex-core-optMay2010 hex-core-opt
May2010 hex-core-opt
 
From Java to Parellel Clojure - Clojure South 2019
From Java to Parellel Clojure - Clojure South 2019From Java to Parellel Clojure - Clojure South 2019
From Java to Parellel Clojure - Clojure South 2019
 
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
 
Functional programming
Functional programmingFunctional programming
Functional programming
 
Scala is java8.next()
Scala is java8.next()Scala is java8.next()
Scala is java8.next()
 
Silicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM Mechanics
 
C++totural file
C++totural fileC++totural file
C++totural file
 
C++ tutorial
C++ tutorialC++ tutorial
C++ tutorial
 
Clojure concurrency
Clojure concurrencyClojure concurrency
Clojure concurrency
 
JavaScript Editions ES7, ES8 and ES9 vs V8
JavaScript Editions ES7, ES8 and ES9 vs V8JavaScript Editions ES7, ES8 and ES9 vs V8
JavaScript Editions ES7, ES8 and ES9 vs V8
 

Dernier

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 

Dernier (20)

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 

Continuations in scala (incomplete version)

  • 1. continuations in fujohnwang @Twitter @weibo Saturday, July 9, 2011
  • 2. what’s continuation? Continuation capture the state of a computation(maybe to be invoked later). Simple concept, but hard to get. first-class support in schema language Saturday, July 9, 2011
  • 3. know CPS first normal control flow structure control flow structure after cps PS.  code  sample  borrowed  from  http://www.slideshare.net/openbala/continuations Saturday, July 9, 2011
  • 4. WHat’s the big deal? Saturday, July 9, 2011
  • 5. usage scenarios programming design pattern coroutine exception handling web frameworks backtracking Saturday, July 9, 2011
  • 6. observer pattern with continuation Saturday, July 9, 2011
  • 7. Coroutine? see the blog of jim mcbeatch Saturday, July 9, 2011
  • 8. Exception handling No sample code yet Saturday, July 9, 2011
  • 9. Web Framework with continuation support seaside / smalltalk cocoon / Java http://cocoon.apache.org/2.1/userdocs/flow/continuations.html weblocks / common lisp wee / ruby ocsigen / ocaml more... Saturday, July 9, 2011
  • 11. code pieces function calculator() { var a, b, operator; cocoon.sendPageAndWait("getA.html"); a = cocoon.request.get("a"); cocoon.sendPageAndWait("getB.html"); b = cocoon.request.get("b"); cocoon.sendPageAndWait("getOperator.html"); operator = cocoon.request.get("op"); try { if (operator == "plus") cocoon.sendPage("result.html", {result: a + b}); else if (operator == "minus") cocoon.sendPage("result.html", {result: a - b}); else if (operator == "multiply") cocoon.sendPage("result.html", {result: a * b}); else if (operator == "divide") cocoon.sendPage("result.html", {result: a / b}); else cocoon.sendPage("invalidOperator.html", {operator: operator}); } catch (exception) { cocoon.sendPage("error.html", {message: "Operation failed: " + exception.toString ()}); } Saturday,} 9, 2011 July
  • 12. Continuation types full continuation(aka. first-class cont.) delimited continuation (aka. partial, composable cont.) write async code as sequence one mix cps code and normal code seamlessly Saturday, July 9, 2011
  • 13. What DC looks like? reset  { reset  {        println(1)        println(1)        shift  {  cont  =>        shift  {  cont  =>  }                println(2)        println(2)        } }        println(3) //prints:  1 } //prints:  1  2 reset  {        println(1)   def  is123(n:Int):Boolean  =  {        shift  {  cont  =>         reset  {                cont()             shift  {  k  :  (Int=>String)  =>                println(2)                   (k(n)  ==  "123")        }             }.toString        println(3)         } }   } //prints:  1  3  2 Saturday, July 9, 2011
  • 14. first glance with dc reset and shift reset sets up the boundary of dc(‘s cps) shift captures the continuation Result types yield return Saturday, July 9, 2011
  • 15. puzzle about yield and return Saturday, July 9, 2011
  • 16. scala cont features compiler plugin + Library compiler plugin does cps transformation library supports control structures and directives serializable (can be saved, distribute sys...) see swarm?! Others? Saturday, July 9, 2011
  • 17. available softwares swarm scalaflow Akka’s DataFlow Concurrency library nio actor implementation for akka nioserver Saturday, July 9, 2011
  • 18. What I want to do with it coroutine combine with java nio resource-efficient minimally-threaded networking layer framework reduce hw cost finally Saturday, July 9, 2011
  • 20. References http://www.scala-lang.org/node/2096 http://okmij.org/ftp/continuations/Continuations.html http://jim-mcbeath.blogspot.com/2010/08/delimited-continuations.html http://lamp.epfl.ch/~rompf/continuations-icfp09.pdf http://okmij.org/ftp/continuations/index.html http://suereth.blogspot.com/2010/03/how-you-should-think-about-delimited.html http://dcsobral.blogspot.com/2009/07/delimited-continuations-explained-in.html http://blog.richdougherty.com/2009/02/delimited-continuations-in-scala_24.html http://en.wikipedia.org/wiki/Seaside_(software) http://en.wikipedia.org/wiki/Call-with-current-continuation http://community.schemewiki.org/?call-with-current-continuation-for-C-programmers http://community.schemewiki.org/?call-with-current-continuation http://en.wikipedia.org/wiki/Coroutine http://cocoon.apache.org/2.1/userdocs/flow/continuations.html https://github.com/rschildmeijer/loft Saturday, July 9, 2011