Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
continuation_web_framework_scheme.pdf
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Niyarin
July 25, 2019
Programming
420
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
190
bel lispの紹介
niyarin
0
800
nanopass-compiler-frameworkを使ってみました
niyarin
0
510
Gorgos-parser-combinator-written-in-scheme
niyarin
0
430
outputting-beautiful-s-expression
niyarin
0
430
Serialisp
niyarin
1
750
Mongo DBとS式検索
niyarin
0
360
goodbye-python-repl
niyarin
0
410
SchemeのEphemeronとWeak Pairの説明
niyarin
0
1.1k
Other Decks in Programming
See All in Programming
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
1.2k
Inertia Rails: The One-Person Framework with React & Friends
skryukov
0
200
AI時代のTerminal環境を UNIX哲学で設計・運用する
yasunori0418
1
330
Zero-Tap Sign-In対応、結局何をすればいいの?
mitohato14
0
1.2k
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
330
クラウドエージェントは、 何がそんなに便利なのか / what makes cloud agents so useful
rkaga
4
660
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
250
Apple Intelligenceとオンデバイス時代の到来
yahir0
0
180
S3 TablesのIcebergデータに、AIエージェントからアクセスしてみた / 20261016developersio2026joetsu-accessing-iceberg-in-s3tables-via-agent
kasacchiful
PRO
0
250
JIS keyboard support in Omarchy
lef237
0
180
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
220
Python Lambdaにおけるテストしやすい設計とAI支援の活用 / Designing Testable Python Lambda Functions with AI
kitano_yuichi
1
270
Featured
See All Featured
Paper Plane (Part 1)
katiecoart
PRO
2
12k
Making Projects Easy
brettharned
120
6.8k
エンジニアに許された特別な時間の終わり
watany
109
250k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
290
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
290
Everyday Curiosity
cassininazir
0
380
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.4k
HDC tutorial
michielstock
2
990
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
380
It's Worth the Effort
3n
188
29k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.7k
How to train your dragon (web standard)
notwaldorf
96
6.9k
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アプリケーションを自然にかける ・いつか正式にリリースしたい 終わり