Mirah Talk for Boulder Ruby Group
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Mirah Talk for Boulder Ruby Group

on

  • 1,247 views

In which I talk about what Mirah is and some of it's fine features.

In which I talk about what Mirah is and some of it's fine features.

Statistics

Views

Total Views
1,247
Views on SlideShare
1,123
Embed Views
124

Actions

Likes
0
Downloads
7
Comments
0

2 Embeds 124

http://blog.baroquebobcat.com 114
https://twitter.com 10

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Mirah Talk for Boulder Ruby Group Presentation Transcript

  • 1. Mirah
  • 2. What’s Mirah?
  • 3. It’s a small, fast,JVM language that uses Ruby syntax.
  • 4. How’d it come about?
  • 5. Charles Oliver Nutter, JRuby guy
  • 6. Wanted to writeJava code in Ruby
  • 7. Wanted to writeJava code in Ruby
  • 8. Wanted to write Javacode in a language as expressive as Ruby.
  • 9. Expressive as Ruby?
  • 10. http://www.flickr.com/photos/caroslines/513429518/
  • 11. Syntactic Sugar• Optional Arguments• Internal Iteration(each, map, etc)• Closures• Literals• String Interpretation
  • 12. Mirahs got the sugar.
  • 13. How Mirah Differs from Ruby
  • 14. 1. It’s statically typed and compiled
  • 15. Basically,No RuntimeObject/ClassModification
  • 16. 2. It uses Java’s type system
  • 17. It has slightly differentsemantics than Rubys
  • 18. e.g.,Mirah has interfaces
  • 19. So, what’s it look like?
  • 20. FibonacciExample
  • 21. Rubydef fib(a)  if a < 2    a  else    fib(a - 1) + fib(a - 2)  endend
  • 22. Mirahgithub.com/mirah/mirah/examples/fib.mirahdef fib(a:int):int  if a < 2    a  else    fib(a - 1) + fib(a - 2)  endend
  • 23. See what I did there?
  • 24. def fib(a:int):int
  • 25. def fib(a:int):int
  • 26. Ruby Syntax+ Java Types- Runtime Modification
  • 27. Other Super Powers
  • 28. Type Inference & Macros
  • 29. Type Inference?
  • 30. Javaclass Foo { private int bar; Foo() { bar = 1; } public int bar() { return bar; }}
  • 31. Rubyclass Foo def initialize @bar = 1 end def bar @bar endend
  • 32. Mirahclass Foo def initialize @bar = 1 end def bar @bar endend
  • 33. @bar is inferred to be an Integer
  • 34. Mirahclass Foo def initialize @bar = 1 end def bar @bar endend
  • 35. Javaclass Foo { private int bar; Foo() { bar = 1; } public int bar() { return bar; }}
  • 36. Mirah Java// Generated from foo.mirahpublic class Foo extends java.lang.Object private int bar; public Foo() { this.bar = 1; } public int bar() { return this.bar; }}
  • 37. Ruby Syntax+ Java Types- Runtime Modification+ Type Inference
  • 38. Macros
  • 39. For Convenience & Awesomeness.
  • 40. Used by the compiler
  • 41. For example,
  • 42. puts =>System.out.println();
  • 43. Macros:How each, map, ==, etc are implemented
  • 44. Macro Basics
  • 45. say you have code like:logger.debug( "this #{takes_too_much_time}")
  • 46. runtakes_too_much_time in production?
  • 47. No,it takes too much time.
  • 48. Macros to the rescue
  • 49. macro def debug debug_input quote do if logger.debugEnabled logger.debug `debug_input` end endend
  • 50. macro def debug debug_input quote do if logger.debugEnabled logger.debug `debug_input` end endend
  • 51. macro def debug debug_input quote do if logger.debugEnabled logger.debug `debug_input` end endend
  • 52. macro def debug debug_input quote do if logger.debugEnabled logger.debug `debug_input` end endend
  • 53. macro def debug debug_input quote do if logger.debugEnabled logger.debug `debug_input` end endend
  • 54. debug( "this #{takes_too_much_time}")
  • 55. if logger.debugEnabled logger.debug("this #takes_too_much_time}" )end
  • 56. debug( "this #{takes_too_much_time}")
  • 57. So, Macros are nifty
  • 58. Ruby Syntax+ Java Types- Runtime Modification+ Type Inference+ Macros
  • 59. Oh, theres another thing.
  • 60. No Runtime Library
  • 61. You can do this:$ mirahc -e "puts hello BRG"$ java -classpath . DashE.class
  • 62. No Runtime ==Small compiled footprint
  • 63. Small Footprint ==good for mobile
  • 64. For example, see Pindah
  • 65. Ruby Syntax+ Java Types- Runtime Modification+ Type Inference+ Macros- Runtime Library
  • 66. Get Started$ rvm jruby$ gem install mirah$ mirah -e "puts hello world
  • 67. Mirah projects to check out: • Dubious - Rails-like web framework for Google App Engine • Pindah - Android App framework
  • 68. Im Nick@baroquebobcat
  • 69. I work at
  • 70. Were Hiring.gnip.com/jobs
  • 71. A couple links mirah.orggithub.com/mirah
  • 72. Questions?