SlideShare a Scribd company logo
1 of 32
Download to read offline
+= 0.1
require   ‘yarv’
require   ‘syntax-1.9’
require   ‘stdlib-1.9’
require   ‘unicode’



   Stephen Touset <stephen@touset.org>
Play Along at Home
$ svn export 
  http://svn.ruby-lang.org/repos/ruby/tags/v1_9_9_0 
  ruby-1.9.0

$   cd ruby-1.9.0
$   ./configure --program-suffix 1.9
$   make
$   make test

$ chmod a+x bin/irb
$ PATH=. RUBYLIB=quot;./libquot; bin/irb
YARV FTW

• Faster
• Less Memory
• Native threads*
• Fun Acronym
                    *concurrency of one
ruby 1.8   ruby 1.9   improvement
   app_answer      0.460      0.146        68%
       app_erb     1.655      1.646        0.5%
  app_factorial    0.762      0.858       -13%
        app_fib     5.572      1.530        73%
app_mandelbrot     2.034      0.848        58%
app_pentomino     92.811     50.778        45%
     app_raise     1.984      2.474       -25%
     app_strcat    1.414      1.113        21%
       app_tak     8.306      2.083        75%
      app_tarai    6.530      1.660        75%
       app_uri     3.555      2.027        43%
≈38% faster
  (62% as slow)
    ((twice-ish as fast))
Yet Another Meaningless Benchmark




       (http://www.timestretch.com/FractalBenchmark.html)
The Image Below is
Not Photoshopped
...thus ending the
language wars once and
          for all
Shiny New Syntax
• Lambda shortcut
• Implicit #call
• Literal hashes
• Block parameters
• Function parameter insanity
• Block local variables
lambda, v1.9


   ->
λ
_
/|
_
    /|
->
λ
->
 “I found lambda!”
            - Matz
c = lambda {|a, b| [b, a] }


        - becomes -

c = ->(a, b) { [b, a] }
Implicit #call
c = lambda {|a, b| [b, a] }
c.call(1, 2)

        - becomes -

c = ->(a, b) { [b, a] }
c.(1,2)
Block Parameters
lambda {|a, b, c = 1, &d| d.call }
                ^
syntax error, unexpected '}' ...

           - becomes -

->(a, b, c = 1, &d) { d.call }
laaaaame
lambda { yield }.call { puts ‘hi’ }
LocalJumpError: no block given

            - becomes -

-> { yield }.() { puts ‘hi’ }
LocalJumpError: no block given
Literal Hashes
{ :a => 1, :b => 2,
  :c => 3, :d => 4 }

    - becomes -

{ a: 1, b: 2,
  c: 3, d: 4 }
W...T...
def foo(a, b = 100, c)
  puts “#{a} #{b} #{c}”
end

foo(3)       # => ArgumentError
foo(3, 5)    # => 3, 100, 5
foo(3, 4, 5) # => 3, 4, 5
...F

def bar(a, b = nil, *c, d)
end
Block Local Variables

   i = Elephant.new
   [1,2,3].map {|i| i * 2 }

   i # => #<Elephant:0x3688b4>
stdlib.succ!
• send no longer calls private methods
• #methods and its siblings return symbols
• class variables are not inherited, now work
  like class instance variables
  (thus obsoleting my entire metaprogramming presentation)


• blocks passable to #[]
• enumerator love
• Oniguruma regexp engine
#tap that class
Passes an object to a block, then returns the object
              (useful for call chaining)




‘foo’.tap(&:upcase!).tap {|s| s.gsub! /oo/, ‘u’ }
Wait, did I see that
    correctly?

  tap(&:upcase!)
      ^^
Enumerator Love

[1, 2, 3].cycle {|i| puts i }        # loops forever puts-ing 1,2,3

[1, 2, 3].first(2)                   # => [1,2]

[1, 2, 3].map.with_index {|o,i| i}   # => [0, 1, 2]

[1, 3, 4, 2].take {|i| i < 4 }       # => [1, 3]

[1, 2, 3].reduce(:+1)                # => 6
Ordered Hashes

h = { a: 1, b: 2, c: 3 }

h        # => { a: 1, b: 2, c: 3 }
h.keys   # => [ :a, :b, :c ]
h.values # => [ 1, 2, 3 ]
Encoded Strings

• No longer Enumerable
 • String#bytes
 • String#lines
 • String#each_char
• “One-char-wide” String behavior
#!/usr/bin/ruby -w
     # -*- coding: utf-8 -*-

      open(filename, ‘r:utf-8’)


encodings = %w{ utf-8        utf-16
                ascii-8bit   euc-jp }
More Info

•   Summary of Changes in 1.9
     http://eigenclass.org/hiki/Changes+in+Ruby+1.9


•   Mechanically Verified 1.9 Changelog
     http://eigenclass.org/hiki/mechanically-verified-ruby19-changelog


•   Matz’ RubyConf 2007 Keynote
     http://rubyconf2007.confreaks.com/d2t1p8_keynote.html
exit(0)

More Related Content

What's hot

Writing Modular Command-line Apps with App::Cmd
Writing Modular Command-line Apps with App::CmdWriting Modular Command-line Apps with App::Cmd
Writing Modular Command-line Apps with App::CmdRicardo Signes
 
Vim Hacks (OSSF)
Vim Hacks (OSSF)Vim Hacks (OSSF)
Vim Hacks (OSSF)Lin Yo-An
 
Ruby to Elixir - what's great and what you might miss
Ruby to Elixir - what's great and what you might missRuby to Elixir - what's great and what you might miss
Ruby to Elixir - what's great and what you might missTobias Pfeiffer
 
Dataflow: Declarative concurrency in Ruby
Dataflow: Declarative concurrency in RubyDataflow: Declarative concurrency in Ruby
Dataflow: Declarative concurrency in RubyLarry Diehl
 
The promise of asynchronous php
The promise of asynchronous phpThe promise of asynchronous php
The promise of asynchronous phpWim Godden
 
Elixir & Phoenix - fast, concurrent and explicit
Elixir & Phoenix - fast, concurrent and explicitElixir & Phoenix - fast, concurrent and explicit
Elixir & Phoenix - fast, concurrent and explicitTobias Pfeiffer
 
Learning From Ruby (Yapc Asia)
Learning From Ruby (Yapc Asia)Learning From Ruby (Yapc Asia)
Learning From Ruby (Yapc Asia)Kang-min Liu
 
The promise of asynchronous php
The promise of asynchronous phpThe promise of asynchronous php
The promise of asynchronous phpWim Godden
 
Shell实现的windows回收站功能的脚本
Shell实现的windows回收站功能的脚本Shell实现的windows回收站功能的脚本
Shell实现的windows回收站功能的脚本Lingfei Kong
 
Trading with opensource tools, two years later
Trading with opensource tools, two years laterTrading with opensource tools, two years later
Trading with opensource tools, two years laterclkao
 
Using the Command Line with Magento
Using the Command Line with MagentoUsing the Command Line with Magento
Using the Command Line with MagentoMatthew Haworth
 
YAPC::Tiny Introduction
YAPC::Tiny IntroductionYAPC::Tiny Introduction
YAPC::Tiny IntroductionKang-min Liu
 
Working with databases in Perl
Working with databases in PerlWorking with databases in Perl
Working with databases in PerlLaurent Dami
 
Functional pe(a)rls: Huey's zipper
Functional pe(a)rls: Huey's zipperFunctional pe(a)rls: Huey's zipper
Functional pe(a)rls: Huey's zipperosfameron
 
"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014Henning Jacobs
 

What's hot (20)

Paexec -- distributed tasks over network or cpus
Paexec -- distributed tasks over network or cpusPaexec -- distributed tasks over network or cpus
Paexec -- distributed tasks over network or cpus
 
Unix 5 en
Unix 5 enUnix 5 en
Unix 5 en
 
Writing Modular Command-line Apps with App::Cmd
Writing Modular Command-line Apps with App::CmdWriting Modular Command-line Apps with App::Cmd
Writing Modular Command-line Apps with App::Cmd
 
Command
CommandCommand
Command
 
Vim Hacks (OSSF)
Vim Hacks (OSSF)Vim Hacks (OSSF)
Vim Hacks (OSSF)
 
Ruby to Elixir - what's great and what you might miss
Ruby to Elixir - what's great and what you might missRuby to Elixir - what's great and what you might miss
Ruby to Elixir - what's great and what you might miss
 
Dataflow: Declarative concurrency in Ruby
Dataflow: Declarative concurrency in RubyDataflow: Declarative concurrency in Ruby
Dataflow: Declarative concurrency in Ruby
 
The promise of asynchronous php
The promise of asynchronous phpThe promise of asynchronous php
The promise of asynchronous php
 
Elixir & Phoenix - fast, concurrent and explicit
Elixir & Phoenix - fast, concurrent and explicitElixir & Phoenix - fast, concurrent and explicit
Elixir & Phoenix - fast, concurrent and explicit
 
Learning From Ruby (Yapc Asia)
Learning From Ruby (Yapc Asia)Learning From Ruby (Yapc Asia)
Learning From Ruby (Yapc Asia)
 
The promise of asynchronous php
The promise of asynchronous phpThe promise of asynchronous php
The promise of asynchronous php
 
Shell实现的windows回收站功能的脚本
Shell实现的windows回收站功能的脚本Shell实现的windows回收站功能的脚本
Shell实现的windows回收站功能的脚本
 
Shell and perl scripting classes in mumbai
Shell and perl scripting classes in mumbaiShell and perl scripting classes in mumbai
Shell and perl scripting classes in mumbai
 
Trading with opensource tools, two years later
Trading with opensource tools, two years laterTrading with opensource tools, two years later
Trading with opensource tools, two years later
 
Groovy
GroovyGroovy
Groovy
 
Using the Command Line with Magento
Using the Command Line with MagentoUsing the Command Line with Magento
Using the Command Line with Magento
 
YAPC::Tiny Introduction
YAPC::Tiny IntroductionYAPC::Tiny Introduction
YAPC::Tiny Introduction
 
Working with databases in Perl
Working with databases in PerlWorking with databases in Perl
Working with databases in Perl
 
Functional pe(a)rls: Huey's zipper
Functional pe(a)rls: Huey's zipperFunctional pe(a)rls: Huey's zipper
Functional pe(a)rls: Huey's zipper
 
"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014
 

Viewers also liked

Tìm ý tưởng bài viết mới với BUZZsumo
Tìm ý tưởng bài viết mới với BUZZsumoTìm ý tưởng bài viết mới với BUZZsumo
Tìm ý tưởng bài viết mới với BUZZsumoFXVIET DAUTUFOREX
 
Tuyển tập 500 mẫu quảng cáo Twitter ấn tượng
Tuyển tập 500 mẫu quảng cáo Twitter ấn tượngTuyển tập 500 mẫu quảng cáo Twitter ấn tượng
Tuyển tập 500 mẫu quảng cáo Twitter ấn tượngCộng đồng iSocial
 
Bm Unit 2.3 Communication
Bm Unit 2.3 CommunicationBm Unit 2.3 Communication
Bm Unit 2.3 CommunicationMr. D. .
 
Bm Chapter 1.9 Globalization
Bm Chapter 1.9 GlobalizationBm Chapter 1.9 Globalization
Bm Chapter 1.9 GlobalizationMr. D. .
 
Globalization Presentation
Globalization PresentationGlobalization Presentation
Globalization Presentationphilpiedt
 
The Causes and Effects of Globalisation
The Causes and Effects of GlobalisationThe Causes and Effects of Globalisation
The Causes and Effects of GlobalisationAisling O Connor
 

Viewers also liked (9)

Policy+webinar+vn
Policy+webinar+vnPolicy+webinar+vn
Policy+webinar+vn
 
Tìm ý tưởng bài viết mới với BUZZsumo
Tìm ý tưởng bài viết mới với BUZZsumoTìm ý tưởng bài viết mới với BUZZsumo
Tìm ý tưởng bài viết mới với BUZZsumo
 
Tuyển tập 500 mẫu quảng cáo Twitter ấn tượng
Tuyển tập 500 mẫu quảng cáo Twitter ấn tượngTuyển tập 500 mẫu quảng cáo Twitter ấn tượng
Tuyển tập 500 mẫu quảng cáo Twitter ấn tượng
 
Bm Unit 2.3 Communication
Bm Unit 2.3 CommunicationBm Unit 2.3 Communication
Bm Unit 2.3 Communication
 
CUSTOMER INSIGHT (Đặng Thanh Vân)
CUSTOMER INSIGHT (Đặng Thanh Vân)CUSTOMER INSIGHT (Đặng Thanh Vân)
CUSTOMER INSIGHT (Đặng Thanh Vân)
 
Bm Chapter 1.9 Globalization
Bm Chapter 1.9 GlobalizationBm Chapter 1.9 Globalization
Bm Chapter 1.9 Globalization
 
Globalization Presentation
Globalization PresentationGlobalization Presentation
Globalization Presentation
 
The Causes and Effects of Globalisation
The Causes and Effects of GlobalisationThe Causes and Effects of Globalisation
The Causes and Effects of Globalisation
 
Globalisation ppt 2
Globalisation ppt 2Globalisation ppt 2
Globalisation ppt 2
 

Similar to Ruby 1.9

Migrating To Ruby1.9
Migrating To Ruby1.9Migrating To Ruby1.9
Migrating To Ruby1.9tomaspavelka
 
From Javascript To Haskell
From Javascript To HaskellFrom Javascript To Haskell
From Javascript To Haskellujihisa
 
Cより速いRubyプログラム
Cより速いRubyプログラムCより速いRubyプログラム
Cより速いRubyプログラムkwatch
 
Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?osfameron
 
Benchmarking Perl (Chicago UniForum 2006)
Benchmarking Perl (Chicago UniForum 2006)Benchmarking Perl (Chicago UniForum 2006)
Benchmarking Perl (Chicago UniForum 2006)brian d foy
 
Ruby19 osdc-090418222718-phpapp02
Ruby19 osdc-090418222718-phpapp02Ruby19 osdc-090418222718-phpapp02
Ruby19 osdc-090418222718-phpapp02Apoorvi Kapoor
 
Useful javascript
Useful javascriptUseful javascript
Useful javascriptLei Kang
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with ClojureDmitry Buzdin
 
Hacking with ruby2ruby
Hacking with ruby2rubyHacking with ruby2ruby
Hacking with ruby2rubyMarc Chung
 
My First Rails Plugin - Usertext
My First Rails Plugin - UsertextMy First Rails Plugin - Usertext
My First Rails Plugin - Usertextfrankieroberto
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Aslak Hellesøy
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Aslak Hellesøy
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Aslak Hellesøy
 
PHP tips and tricks
PHP tips and tricks PHP tips and tricks
PHP tips and tricks Damien Seguy
 
Ruby - Uma Introdução
Ruby - Uma IntroduçãoRuby - Uma Introdução
Ruby - Uma IntroduçãoÍgor Bonadio
 
Refactor like a boss
Refactor like a bossRefactor like a boss
Refactor like a bossgsterndale
 
Python language data types
Python language data typesPython language data types
Python language data typesHarry Potter
 

Similar to Ruby 1.9 (20)

Migrating To Ruby1.9
Migrating To Ruby1.9Migrating To Ruby1.9
Migrating To Ruby1.9
 
From Javascript To Haskell
From Javascript To HaskellFrom Javascript To Haskell
From Javascript To Haskell
 
Ruby 1.9
Ruby 1.9Ruby 1.9
Ruby 1.9
 
Cより速いRubyプログラム
Cより速いRubyプログラムCより速いRubyプログラム
Cより速いRubyプログラム
 
Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?
 
Benchmarking Perl (Chicago UniForum 2006)
Benchmarking Perl (Chicago UniForum 2006)Benchmarking Perl (Chicago UniForum 2006)
Benchmarking Perl (Chicago UniForum 2006)
 
Ruby19 osdc-090418222718-phpapp02
Ruby19 osdc-090418222718-phpapp02Ruby19 osdc-090418222718-phpapp02
Ruby19 osdc-090418222718-phpapp02
 
Tork03 LT
Tork03 LT Tork03 LT
Tork03 LT
 
Useful javascript
Useful javascriptUseful javascript
Useful javascript
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
Hacking with ruby2ruby
Hacking with ruby2rubyHacking with ruby2ruby
Hacking with ruby2ruby
 
My First Rails Plugin - Usertext
My First Rails Plugin - UsertextMy First Rails Plugin - Usertext
My First Rails Plugin - Usertext
 
Groovy
GroovyGroovy
Groovy
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009
 
PHP tips and tricks
PHP tips and tricks PHP tips and tricks
PHP tips and tricks
 
Ruby - Uma Introdução
Ruby - Uma IntroduçãoRuby - Uma Introdução
Ruby - Uma Introdução
 
Refactor like a boss
Refactor like a bossRefactor like a boss
Refactor like a boss
 
Python language data types
Python language data typesPython language data types
Python language data types
 

Recently uploaded

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 

Recently uploaded (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 

Ruby 1.9

  • 1. += 0.1 require ‘yarv’ require ‘syntax-1.9’ require ‘stdlib-1.9’ require ‘unicode’ Stephen Touset <stephen@touset.org>
  • 2. Play Along at Home $ svn export http://svn.ruby-lang.org/repos/ruby/tags/v1_9_9_0 ruby-1.9.0 $ cd ruby-1.9.0 $ ./configure --program-suffix 1.9 $ make $ make test $ chmod a+x bin/irb $ PATH=. RUBYLIB=quot;./libquot; bin/irb
  • 3. YARV FTW • Faster • Less Memory • Native threads* • Fun Acronym *concurrency of one
  • 4. ruby 1.8 ruby 1.9 improvement app_answer 0.460 0.146 68% app_erb 1.655 1.646 0.5% app_factorial 0.762 0.858 -13% app_fib 5.572 1.530 73% app_mandelbrot 2.034 0.848 58% app_pentomino 92.811 50.778 45% app_raise 1.984 2.474 -25% app_strcat 1.414 1.113 21% app_tak 8.306 2.083 75% app_tarai 6.530 1.660 75% app_uri 3.555 2.027 43%
  • 5. ≈38% faster (62% as slow) ((twice-ish as fast))
  • 6. Yet Another Meaningless Benchmark (http://www.timestretch.com/FractalBenchmark.html)
  • 7. The Image Below is Not Photoshopped
  • 8. ...thus ending the language wars once and for all
  • 9. Shiny New Syntax • Lambda shortcut • Implicit #call • Literal hashes • Block parameters • Function parameter insanity • Block local variables
  • 11. λ
  • 12. _ /|
  • 13. _ /|
  • 14. ->
  • 15. λ -> “I found lambda!” - Matz
  • 16. c = lambda {|a, b| [b, a] } - becomes - c = ->(a, b) { [b, a] }
  • 17. Implicit #call c = lambda {|a, b| [b, a] } c.call(1, 2) - becomes - c = ->(a, b) { [b, a] } c.(1,2)
  • 18. Block Parameters lambda {|a, b, c = 1, &d| d.call } ^ syntax error, unexpected '}' ... - becomes - ->(a, b, c = 1, &d) { d.call }
  • 19. laaaaame lambda { yield }.call { puts ‘hi’ } LocalJumpError: no block given - becomes - -> { yield }.() { puts ‘hi’ } LocalJumpError: no block given
  • 20. Literal Hashes { :a => 1, :b => 2, :c => 3, :d => 4 } - becomes - { a: 1, b: 2, c: 3, d: 4 }
  • 21. W...T... def foo(a, b = 100, c) puts “#{a} #{b} #{c}” end foo(3) # => ArgumentError foo(3, 5) # => 3, 100, 5 foo(3, 4, 5) # => 3, 4, 5
  • 22. ...F def bar(a, b = nil, *c, d) end
  • 23. Block Local Variables i = Elephant.new [1,2,3].map {|i| i * 2 } i # => #<Elephant:0x3688b4>
  • 24. stdlib.succ! • send no longer calls private methods • #methods and its siblings return symbols • class variables are not inherited, now work like class instance variables (thus obsoleting my entire metaprogramming presentation) • blocks passable to #[] • enumerator love • Oniguruma regexp engine
  • 25. #tap that class Passes an object to a block, then returns the object (useful for call chaining) ‘foo’.tap(&:upcase!).tap {|s| s.gsub! /oo/, ‘u’ }
  • 26. Wait, did I see that correctly? tap(&:upcase!) ^^
  • 27. Enumerator Love [1, 2, 3].cycle {|i| puts i } # loops forever puts-ing 1,2,3 [1, 2, 3].first(2) # => [1,2] [1, 2, 3].map.with_index {|o,i| i} # => [0, 1, 2] [1, 3, 4, 2].take {|i| i < 4 } # => [1, 3] [1, 2, 3].reduce(:+1) # => 6
  • 28. Ordered Hashes h = { a: 1, b: 2, c: 3 } h # => { a: 1, b: 2, c: 3 } h.keys # => [ :a, :b, :c ] h.values # => [ 1, 2, 3 ]
  • 29. Encoded Strings • No longer Enumerable • String#bytes • String#lines • String#each_char • “One-char-wide” String behavior
  • 30. #!/usr/bin/ruby -w # -*- coding: utf-8 -*- open(filename, ‘r:utf-8’) encodings = %w{ utf-8 utf-16 ascii-8bit euc-jp }
  • 31. More Info • Summary of Changes in 1.9 http://eigenclass.org/hiki/Changes+in+Ruby+1.9 • Mechanically Verified 1.9 Changelog http://eigenclass.org/hiki/mechanically-verified-ruby19-changelog • Matz’ RubyConf 2007 Keynote http://rubyconf2007.confreaks.com/d2t1p8_keynote.html