Your SlideShare is downloading. ×
0
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Opa presentation at GamesJs
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Opa presentation at GamesJs

256

Published on

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
256
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. @henri_opa http://opalang.org
  • 2. open-source event-basedclient + server
  • 3. #1Simple
  • 4. function register_in_the_room() { $.ajax({ cache: false, type: "POST" , dataType: "json" , url: "/join" , data: { nick: nick } , error: function () { function register_in_the_room() { alert("connection error”); join(nick); onConnect(); showConnect(); } } , success: onConnect function get_list_of_users() { }); users = get_user_list();} showUsers(users);function get_list_of_users() { } jQuery.get("/who", {}, function (data, status) { if (status != "success") return; showUsers(data.nicks); }, "json");}
  • 5. http://github.com/mattgu74/OpaTetris
  • 6. http://github.com/mattgu74/OpaTetris 600
  • 7. 1100
  • 8. #2Cool static typing
  • 9. Nofunction createUser(username, password) { match (findUser(username)) { Type errors at case {none}: user = { username: username, Code fullname: "", password: Crypto.Hash.sha2(password) }; compile time? saveUser(user); Yes default: displayMessage(“This usernameexists”); }; Client.goto("/login"); Error
  • 10. Type checkingfoo = 1 + "bar"; “Types int and string are not compatible”
  • 11. Type inference (almost complete) function foo(s) { String.length(s); } function bar(x, y) { foo(x) + y; }
  • 12. Type inference (almost complete)int function foo(string s) { String.length(s);}int function bar(string x, int y) { foo(x) + y;}
  • 13. element = <div> <span>{prompt({none})}</span> <span>{expr} </div> <div>{Calc.compute(expr)}</div>; Open and close tag mismatch <span> vs </div>
  • 14. case {some: 13}: #status = "Enter";callback(get());case {some: 37}: #status = "Left";move({lef});case {some: 38}: #status = "Up";move({up});case {some: 39}: #status = "Right";move({right}); First type: { lef } Second type: { left } or { right } or { rightmost } or { up } or { down }
  • 15. previous = Dom.get_content(#precaret);#precaret = String.sub(0,String.lenght(previous) - 1,previous);#postcaret += String.get(String.length(previous) - 1, previous); No field ‘lenght’ found. Most probable field: length: string -> int
  • 16. previous = Dom.get_content(#postcaret);#postcaret = String.sub(1,String.length(previous) - 1, previous);#precaret =+ String.get(previous); String.get is a string function(int, string) but application uses it as function(string)
  • 17. “Keep your eye on Opa, thenew open source language that[...] may transform Webdevelopment.” Neil McAllister“Coding in Opa is super quickand fun. I don’t think I couldhave written things faster in anyother framework.” Alok Menghrajani
  • 18. Join device: Tokyohttp://tokyo.local:8667
  • 19. opalang.org @opalang

×