1353001 Web Gmail Google Maps Web. Web. Web,,. Web,. Web. Web Web. Web Web. Web Web Web ( ).,.. Web,...,,.,.,... Web,,..
26 Web 1353001 27 2 10
1 1 3 2 5 2.1 Web... 5 2.2 Web... 6 2.3 Web.................. 10 2.4................................ 12 3 14 3.1.................................. 14 3.2.................................. 15 4 20 4.1 local Storage.... 20 4.2................ 21 4.3.................... 22 4.4 CPS............ 23 4.5..................... 26 5 27 5.1..................... 27 5.2 CPS.................................. 29 5.3 JavaScript Scheme.............. 29 6 34 7 35
2 2.1 Web... 7 2.2 Web... 8 2.3 Web... 9 3.1 Application Market ( [7] )... 16 3.2 Application Market ( [7] )...... 16 3.3 ( [7] ).............. 17 3.4 ( [7] )........... 17 3.5 WOPRE........................ 18 5.1.................... 28
1. 3 1 Gmail Google Maps Web. Web. Web,,. Web,. Web. Web Web. Web Web. Web Web Web,,. Web Web Web ( ).,.. Web,...,,.,.
1. 4,... Web,,.. Web.
2. 5 2 2.1 Web Gmail Google Maps Web. Web,. Android Java. Android ios, Objective-C.. Web. Web. Web Web,. Web,.,. Web. Web, Web Web. Web ( ),. Web.,.,.
2.2 Web 6.,,. Web,,,.,., Web Web, Web Web. 2.2 Web Web Web, Web. Web Web, Web 2.1, 2.2, 2.3. Web Web,,.
2.2 Web 7 2.1 Web
2.2 Web 8 2.2 Web
2.2 Web 9 2.3 Web 2.1, Web, Web. 2.2 Web., local Storage.
2.3 Web 10 local Storage. 2.3 Web. local Storage. local Storage., local Storage, local Storage. local Storage,. local Storage,.. Web. 2.3 Web Web JavaScript. JavaScript, Web Web, Web,. Ajax. Ajax,. Web, Web, Web. Web,., Web. Web,.,... Web,..
2.3 Web 11,. Web. Web,.,... 2.1 Web ( ). 2.2, 2.3. 2.1 1 function proc(){// 2 xhr( a.txt,funciton(a val){ 3 xhr( b.txt,funciton(b val){ 4 xhr( c.txt,funciton(c val){ 5 print(a val+b val+c val); 6 }); 7 }); 8 }); 9 } ( ) 2.2 1 function init(){// 2 prefetch( a.txt, b.txt, c.txt ); 3 } 4 ( ) 5 // 6 function proc(){ 7 print(localstorage get(a key)+localstorage get(b key)+localstorage get(c key)); 8 } 2.3 1 function init(){// 2 prefetch( a.txt, b.txt ); 3 } 4 5 function proc(){// 6 get( a key, a.txt, funciton(a val){ ( )
2.4 12 7 get( b key, b.txt, funciton(b val){ 8 get( c key, c.txt, funciton(c val){ 9 print(a val + b val + c val); 10 }); 11 }); 12 }); 13 } 2.1 xhr, Web. URL,.,. 2.2, localstorage get local Storage.. init. Web.., local Storage,. 2.3, get local Storage, local Storage,. get.,,,. init. 2.2.., get.,. 2.4 Web ( ).,
2.4 13. Web.
3. 14 3 3.1 3.1.1 HTML5 HTML5[1] Web. local Storage Web,. local Storage. HTML5 API(localStorage. setitem) local Storage. local Storage API(localStorage. getitem). Web, local Storage., local Storage..., Web.. 3.1.2 Google Gears Google Gears[4] Google Web, Web.. Google Gears HTML5. Google Gears Web
3.2 15. Google Gears Google Google. Google Gears.. 3.1.3 [2] Web. Web. Web. Web... Web,. 3.2 3.2.1 Web Yung [7] Web WOPRE. WOPRE Web WOPRE, Google Gears. Web,. Apple App Store. WOPRE Application Market App Store. Application Market,. 3.1, 3.2.
3.2 16 3.1 Application Market ( [7] ) 3.2 Application Market ( [7] ) WOPRE Web. Web, Web. WOPRE Web.
3.2 17 Web. 3.3, 3.4. 3.3 ( [7] ) 3.4 ( [7] ). 3.5. WOPRE
3.2 18 3.5 WOPRE 3.2.2 Yaron [8].,.,,. Web. Web. 3.2.3 JavaScript Benjamin [9] Web Web JavaScript Doloto. Doloto JavaScript, Web.
3.2 19. JavaScript.. JavaScript,.. Doloto [3] Microsoft,. 3.2.4 Feeley[10] Balanced Polling. Balanced Polling.,... Balanced Polling,. [13] Punctual Pollling. Punctual Polling..,..,.., Balanced Polling Punctual Polling.
4. 20 4 Web. get,,.. Web JavaScript. Scheme. 4.1 local Storage Web ( ) local Storage. local Storage API, get. get local Storage local Storage. local Storage,. get local Storage. get. get local Storage,. get get, get. get local Storage,,.,.
4.2 21. 4.2 get,.. get,.. 4.1 Scheme.. 4.1 1 (get 2 (lambda (x);k1 3 (get 4 (lambda (y);k2 5 (print (+ x y))) 6 url2 key2)) 7 url1 key1) local Storage,. 4.2. JavaScript get. k1,k2, url1 url2 URL, key local Storage. get URL,. 4.1 url3/key3 z, k2 k1, 4.1 (get url3 key3) +. 4.1 1,, 1 7, 1 get 3 6. get,
4.3 22.. 4.1 4.2. 4.2 1 (+ (get url1 key1) (get url2 key2)) 4.2. get local Storage, url1 url2 URL, key1 key2 local Storage. 4.2 4.1.. get,. 4.3.,... 4.3.1 4.3 4.3 1 (prefetch when <function name>) 4.3 prefetch-when, <function-name>. Scheme.
4.4 CPS 23 4.3.2 <function-name>. local Storage,., local Storage,. 4.4 CPS Scheme. CPS(continuation passing style),. CPS( ). ( ) ( ), CPS. CPS,,. CPS CPS. CPS,. CPS Guy L. Steele, Jr. RABBIT[12], Kranz ORBIT[11]. 4.4.1 CPS CPS.. (lambda (< >...) < >...) (begin < >...) (if < > < > [< >])
4.4 CPS 24 (quote < >) lambda. begin,,. if. < >.,,. 4.4.2 CPS. 4.4 CPS Scheme 1 (+ (+ (get data1 a) (get data2 b)) (get data3 c)) local Storage 3. data1, data2, data3 URL, a, b, c local Storage. 4.4 CPS 4.5. lambda,., 3 lambda (get G19 G20) 3 get 16. G11 get. get. 4.5 CPS Scheme 1 ((lambda (G19) 2 ((lambda (G20) 3 (get (lambda (G11) 4 ((lambda (G14) 5 ((lambda (G15) 6 (get (lambda (G12) 7 (+ (lambda (G3) 8 ((lambda (G6) 9 ((lambda (G7) 10 (get (lambda (G4) (+ G3 G4)) 11 G6 G7)) 12 c)) data3)) 13 G11 G12)) 14 G14 G15)) 15 b)) data2))
4.4 CPS 25 16 G19 G20)) 17 a)) 18 data1) 4.5. 1. data1 G19. ( ) 2. a G20. ( ) 3. (get G19 G20) G11. (3 ) 4. data2 G14. ( ) 5. b G15. 5 ) 6. (get G14 G15) G12. (6 ) 7. (+ G11 G12) G3. (7 ) 8. data3 G6. (8 ) 9. c G7. (9 ) 10. (get G6 G7) G4. (10 ) 11. (+ G3 G4). (10 ). G19=data1 G20=a G11=(get data1 a) G14=data2 G15=b G12=(get data2 b) G3=(+ (get data1 a )(get data2 b)) G6=data3 G7=c G4=(get data3 c) Scheme. CPS. CPS...
4.5 26 4.5.. 1.. 2.. 3. CPS. 4. JavaScript Scheme Web. 1 4.2. 2 4.3,. 3 CPS. 4 3 CPS JavaScript Scheme Web. Scheme, JavaScript.
5. 27 5 5.1..,. Scheme,,,.,. Scheme Gauche[5]. Gauche Scheme Scheme. 5.1.,.. 1., Gauche. key, value. 2., value., URL, local Storage local Storage. 3..
5.1 28 5.1.
5.2 CPS 29 5.2 CPS CPS,,. CPS. CPS convert, CPS CPS. 5.1. 5.1 CPS 1 (convert (+ (+ (get data1 a) (get data2 b)) (get data3 c)) stop) 5.1 CPS (+ (+ (get data1 a) (get data2 b)) (get data3 c)). (+ (+ (get data1 a) (get data2 b)) (get data3 c)) CPS. (+ (+ (get data1 a) (get data2 b)) (get data3 c)) CPS 4.5. 5.3 JavaScript Scheme CPS Scheme [6]. Web Scheme, 5.3.2. 5.3.1 Scheme Scheme. Scheme. (lambda (< >...) < >...) (begin < >..) (if < > < > [< >]) (quote < >) (let ((< > < >)...)< >...) (define (< > < >...) < >...) (time < >)
5.3 JavaScript Scheme 30 lambda. begin,,. if. quote. define. time. 5.3.2 Scheme Web.. (setls ) setls local Storage. setls local Storage. 5.2. 5.2 1 function setls(key, value) { 2 localstorage.setitem(key, value); 3 return true; 4 } setls (getls ) getls local Storage. getls local Storage. 5.3. 5.3 1 function getls(key) { 2 return localstorage.getitem(key); 3 } getls (xhr ) xhr Web,. xhr k(cps ) web URL. 5.4.
5.3 JavaScript Scheme 31 5.4 xhr 1 function xhr(k, url) { 2 var xhrobject = new XMLHttpRequest(); 3 xhrobject.responsetype = text ; 4 xhrobject.onreadystatechange = function() { 5 if (xhrobject.status === 200 && xhrobject.readystate === 4) { 6 var args = [xhrobject.response]; 7 scmeval sequence(k.body, k.env.extend(k.args, args)); 8 9 } 10 }; 11 xhrobject.open( GET, url, true); 12 xhrobject.send(null); 13 return true; 14 } (get ) get local Storage, Web. local Storage local Storage, local Storage Web. get k, Web URL, local Storage. 5.5. 5.5 1 function get(k, url, key) { 2 if (navigator.online) { 3 xhr(k, url); 4 return true; 5 } else { 6 return localstorage.getitem(key); 7 } 8 } get (mouseup ) mouseup ( ). ev, HTML id a. 5.6.
5.3 JavaScript Scheme 32 5.6 mouseup 1 function mouseup(ev, id, a) { 2 var element = id[ name ]; 3 var div = document.getelementbyid(element); 4 var args = []; 5 args.push(a); 6 //. 7 div.onmouseup = function() { 8 scmeval sequence(ev.body, ev.env.extend(ev.args, args)); 9 }; 10 return true; 11 } (mousemove ) mousemove. ev, HTML id a. 5.7. 5.7 mousemove 1 function mousemove(ev, id, a) { 2 var element = id[ name ]; 3 var div = document.getelementbyid(element); 4 var args = []; 5 args.push(a); 6 //. 7 div.onmousemove = function() { 8 scmeval sequence(ev.body, ev.env.extend(ev.args, args)); 9 }; 10 return true; 11 } (mousedown ) mousedown. ev, HTML id a. 5.8. 5.8 1 function mousedown(ev, id, a) { 2 var element = id[ name ]; mousedown
5.3 JavaScript Scheme 33 3 var div = document.getelementbyid(element); 4 var args = a; 5 //. 6 div.onmousedown = function() { 7 scmeval sequence(ev.body, ev.env.extend(ev.args, args)); 8 }; 9 return true; 10 } (mouseclick ) mouseclick. ev, HTML id a. 5.9. 5.9 mouseclick 1 function mouseclick(ev, id, a) { 2 var element = id[ name ]; 3 var div = document.getelementbyid(element); 4 var args = a; 5 //. 6 div.onclick = function() { 7 scmeval sequence(ev.body, ev.env.extend(ev.args, args)); 8 }; 9 return true; 10 }
6. 34 6,. URL, URL.,.,,..,..
7. 35 7 Web. Web. Web.
36,.,,,..,,..
37 [1] HTML5, http://www.w3.org/tr/html5/, Jan., 2015. [2] Offline first, http://blog.joelambert.co.uk/2012/11/26/offline-first-a-better-html5- user-experience/, Jan., 2015. [3] Doloto, http://research.microsoft.com/en-us/projects/doloto/, Jan., 2015. [4] Google Gears, https://code.google.com/p/gears/, Jan., 2015. [5] Gauche, http://practical-scheme.net/gauche/index-j.html, Jan., 2015. [6] The Revised 6 Report on the Algorithmic Language Scheme, http://www.r6rs.org/, Jan., 2015. [7] Yung-Wei Kao, ChiaFeng Lin, Kuei-An Yang and Shyan-Ming Yuan: A Webbased, Offline-able, and Personalized Runtime Environment for executing applications on mobile devices, Computer Standards & Interfaces, Vol.34, No.1, pp.212-224, Jan., 2012. [8] Weinsberg, Y. and Ben-Shaul, I.: A programming model and system support for disconnected-aware applications on resource-constrained devices, Proceedings of the 24th International Conference on Software Engineering (ICSE 02), pp.374-384, May., 2002. [9] Benjamin Livshits and Emre Kcman: Doloto: Code Splitting for Network-Bound Web 2.0 Applications, Proceedings of the 16th ACM SIGSOFT International Symposium on Foundations of software engineering (SIGSOFT 08/FSE-16), pp.350-360, Nov., 2008. [10] Marc Feeley.: Polling efficiently on stock hardware, Proceedings of the conference on Functional programming languages and computer architecture (FPCA 93), pp.179-187, 1993. [11] David Kranz, Richard Kelsey, Jonathan Rees, Paul Hudak, James Philbin, and Norman Adams: ORBIT: an optimizing compiler for scheme, Proceedings of the 1986 SIGPLAN symposium on Compiler construction (SIGPLAN 86), pp.219-233, 1986 [12] Guy L. Steele, Jr.: Rabbit: A Compiler for Scheme, AI Memo474, MIT, 1978 [13],, :, JSPP2001, Jun., 2001