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
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
500
Gorgos-parser-combinator-written-in-scheme
niyarin
0
430
outputting-beautiful-s-expression
niyarin
0
430
Serialisp
niyarin
1
740
Mongo DBとS式検索
niyarin
0
360
goodbye-python-repl
niyarin
0
400
SchemeのEphemeronとWeak Pairの説明
niyarin
0
1.1k
Other Decks in Programming
See All in Programming
Simple Storage Service(S3) is not simple
iwatsukayura
0
120
[ハンズオン]AIへの指示だけで「五目並べ」を作ってみよう
satoshi256kbyte
1
310
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
9
5.2k
フロントエンドUIフレームワークのこれまでとこれから
ssssota
5
3.1k
AHC070解法紹介
eijirou
0
150
Heart of Swift Concurrency
koher
0
1.1k
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
810
更なる可用性を求めて、5年間運用したKotlinのアプリケーションをGoでリプレイスする話
ken_tunc
0
420
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
170
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.2k
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
460
App Intentsのビルドプロセスを支える技術
kntkymt
0
490
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
187
23k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Everyday Curiosity
cassininazir
0
340
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.3k
Designing for humans not robots
tammielis
254
26k
Test your architecture with Archunit
thirion
2
2.4k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
Six Lessons from altMBA
skipperchong
29
4.5k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
76k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
710
Building Adaptive Systems
keathley
44
3.2k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
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アプリケーションを自然にかける ・いつか正式にリリースしたい 終わり