Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
continuation_web_framework_scheme.pdf
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Niyarin
July 25, 2019
Programming
410
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
continuation_web_framework_scheme.pdf
Niyarin
July 25, 2019
More Decks by Niyarin
See All by Niyarin
Scheme用nREPLの開発(エラー出力の改善)
niyarin
0
180
bel lispの紹介
niyarin
0
790
nanopass-compiler-frameworkを使ってみました
niyarin
0
490
Gorgos-parser-combinator-written-in-scheme
niyarin
0
420
outputting-beautiful-s-expression
niyarin
0
420
Serialisp
niyarin
1
730
Mongo DBとS式検索
niyarin
0
360
goodbye-python-repl
niyarin
0
390
SchemeのEphemeronとWeak Pairの説明
niyarin
0
1.1k
Other Decks in Programming
See All in Programming
スマートグラスで並列バイブコーディング
hyshu
0
280
なぜ型を書くのか? TSKaigi2026で改めて考える #tskaigi_smarthr
kajitack
0
190
才能?センス?知らん、 続けたもん勝ちだ。-- 結婚・出産・癌を越えてなお、私がプロダクトを創り続ける理由
16bitidol
2
740
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
140
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
830
The NotImplementedError Problem in Ruby
koic
1
1.1k
関数型プログラミングのメリットって何だろう?
wanko_it
0
130
これからAgentCoreを触る方へトレンドはGatewayです
har1101
6
470
AI がコードを書く時代における新卒エンジニアの仕事風景 (2026) / New Graduate Engineers in the Era of AI Coding (2026)
sushichan044
0
200
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
21
7.2k
AIキャラアプリkaiwaの低遅延音声通話基盤をどう作ったか - AWS Gravitonで支える低遅延・低コストAI Agent基盤
mogamit
0
160
フィードバックで育てるAI開発
kotaminato
1
100
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
330
40k
How Software Deployment tools have changed in the past 20 years
geshan
0
34k
What does AI have to do with Human Rights?
axbom
PRO
1
2.2k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.3k
Become a Pro
speakerdeck
PRO
31
6k
How to Ace a Technical Interview
jacobian
281
24k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
360
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
230
We Have a Design System, Now What?
morganepeng
55
8.2k
Transcript
継続と アプリケーション (Schemeのオレオレ・Toy・Webフレームワークの紹介) Niyarin
オレオレ・Toy・WebFrameworkを作っています ・継続ベース ・プロトタイプ/学習用なのでセキュリティ、その他はてきとう ・未完成 niyarin/oreore-toy-webframework-scm 継続ベースのWebフレームワークはそれなりにある GaucheのKahua Ypsilonのlunula RacketのWebFramework
etc. 1
継続とは(てきとう) 特徴 ・ジャンプ ・値を渡せる ・状態を保持 (+ 1 (call/cc (lambda (c)
(c 2))) 3) ;6 (define out-c #f) (+ 1 (call/cc (lambda (c) (set! out-c c) (c 2))) 3) (out-c 100) ;104 2
継続をWEBアプリケーションに使う1 ・セッションの保存 . . . リクエスト1 レスポンス1 リクエスト2 レスポンス2 クライアントA
サーバー クライアントA name Taro old 30 セッションデータ (let ((name “Taro”) (old 30)) (call/cc (lambda (cont) ;contにセッション情報をのせる body …))) 3
継続をWEBアプリケーションに使う2 ・ページの遷移 localhost:8080/piyo?a=1&b=2 ↓ (… (call/cc (lambda (piyo) (set!
piyo-page cont))) …);遷移先のページ (piyo;遷移時に継続を呼び出す ‘((a 1) (b 2))) 4
コード紹介1:継続を使うと自然な記述ができる (define (index-page param) (let loop ((uname "") (password
"")) (let ((loginpage-data (call/cc (lambda (cont) (render `(ログインページ )))))) (cond ((not (validation loginpage-data)) (loop (get ‘uname content) (get ‘password content))) (else (render `(OKページ)))))) sample/sample.scm(一部省略) (define (index param) (let loop () (let ((data (read))) (cond ((failure? data) (loop)) (else (display “OK”))))) 同じ構造のプログラム 5
(otw-render-view `(html (body (div (@ (style "color:#ff0000")) ,error-message) (form (@
(action ,(otw-generate-uri cont)) ;生成結果=> piyo?contid=1 (method "post")) (input (@ (type "text") (name "uname") (value ,uname))) (input (@ (type "password") (name "password"))) (input (@ (type "submit") (value "Submit")))))) コード紹介2:どのように継続を渡すのか ID-継続の組で管理して、IDのほうを渡している ※ URLにID埋め込んでいるが、セキュ リティ的には✗ =>継続ハイジャック 6
実装中バグらせた話 (define (index-page param) (let loop ((uname "") (password
"")) (let ((loginpage-data (call/cc (lambda (cont) (render `(ログインページ )))))) (cond ((not (validation loginpage-data)) (loop (get ‘uname content) (get ‘password content))) (else (render `(OKページ)))))) 1. 赤い部分で止める必要がある なにもしないと、青い領域に入る ・render内で大域脱出する ・限定継続ベースにするのも手 2. 2つは違うリクエストなので、レスポン スを出力するポートは別 ・レキシカルな場所(左だとparam)におく と継続に補足される(古いポートが参照さ れる) ・外でスレッド-portで管理している 7
・継続を使うとWebアプリケーションを自然にかける ・いつか正式にリリースしたい 終わり