Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ruby_through_Reserved_Words.pdf

 Ruby_through_Reserved_Words.pdf

Yukihiro Matsumoto

July 02, 2019
Tweet

More Decks by Yukihiro Matsumoto

Other Decks in Programming

Transcript

  1. Powered by Rabbit 2.2.1
    Ruby through Reserved
    Words
    Heroku
    Ruby Association
    Yukihiro "Matz" Matsumoto
    まつもとゆきひろ
    @yukihiro_matz

    View full-size slide

  2. Powered by Rabbit 2.2.1
     
    Ruby has 41 reserved words

    View full-size slide

  3. Powered by Rabbit 2.2.1
     
    Each reflects (early) design
    decisions

    View full-size slide

  4. Powered by Rabbit 2.2.1
     
    The story behinds the words

    View full-size slide

  5. Powered by Rabbit 2.2.1
     
    begin/end

    View full-size slide

  6. Powered by Rabbit 2.2.1
     
    Comb Style Indentation

    View full-size slide

  7. Powered by Rabbit 2.2.1
     
    Inherited from Eiffel

    View full-size slide

  8. Powered by Rabbit 2.2.1
     
    along with rescue, ensure, retry

    View full-size slide

  9. Powered by Rabbit 2.2.1
     
    break/next/redo

    View full-size slide

  10. Powered by Rabbit 2.2.1
     
    not continue

    View full-size slide

  11. Powered by Rabbit 2.2.1
     
    From Perl (shorter)

    View full-size slide

  12. Powered by Rabbit 2.2.1
     
    class/def

    View full-size slide

  13. Powered by Rabbit 2.2.1
     
    From Python

    View full-size slide

  14. Powered by Rabbit 2.2.1
     
    module

    View full-size slide

  15. Powered by Rabbit 2.2.1
     
    Lisp (Flavors)

    View full-size slide

  16. Powered by Rabbit 2.2.1
     
    Mix-in

    View full-size slide

  17. Powered by Rabbit 2.2.1
     
    if/else/elsif

    View full-size slide

  18. Powered by Rabbit 2.2.1
     
    elsif

    View full-size slide

  19. Powered by Rabbit 2.2.1
     
    elseif, elif, elsif

    View full-size slide

  20. Powered by Rabbit 2.2.1
     
    The shortest pronounceable

    View full-size slide

  21. Powered by Rabbit 2.2.1
     
    then

    View full-size slide

  22. Powered by Rabbit 2.2.1
     
    The stop words

    View full-size slide

  23. Powered by Rabbit 2.2.1
     
    then and class methods

    View full-size slide

  24. Powered by Rabbit 2.2.1
     
    unless

    View full-size slide

  25. Powered by Rabbit 2.2.1
     
    From Perl

    View full-size slide

  26. Powered by Rabbit 2.2.1
     
    No elsif or elsunless

    View full-size slide

  27. Powered by Rabbit 2.2.1
     
    while

    View full-size slide

  28. Powered by Rabbit 2.2.1
     
    Simple loop

    View full-size slide

  29. Powered by Rabbit 2.2.1
     
    for/in

    View full-size slide

  30. Powered by Rabbit 2.2.1
     
    From Python?

    View full-size slide

  31. Powered by Rabbit 2.2.1
     
    until

    View full-size slide

  32. Powered by Rabbit 2.2.1
     
    From Perl

    View full-size slide

  33. Powered by Rabbit 2.2.1
     
    true/false/nil

    View full-size slide

  34. Powered by Rabbit 2.2.1
     
    Truthy and Falsy

    View full-size slide

  35. Powered by Rabbit 2.2.1
     
    Three value model

    View full-size slide

  36. Powered by Rabbit 2.2.1
     
    Inspired by Lisp

    View full-size slide

  37. Powered by Rabbit 2.2.1
     
    and/or/not

    View full-size slide

  38. Powered by Rabbit 2.2.1
     
    From Perl

    View full-size slide

  39. Powered by Rabbit 2.2.1
     
    Only for precedence

    View full-size slide

  40. Powered by Rabbit 2.2.1
     
    do/yield

    View full-size slide

  41. Powered by Rabbit 2.2.1
     
    The block

    View full-size slide

  42. Powered by Rabbit 2.2.1
     
    From CLU (1970s, MIT)

    View full-size slide

  43. Powered by Rabbit 2.2.1
     
    The biggest invention of Ruby

    View full-size slide

  44. Powered by Rabbit 2.2.1
     
    rescue/ensure/retry

    View full-size slide

  45. Powered by Rabbit 2.2.1
     
    Exception handling

    View full-size slide

  46. Powered by Rabbit 2.2.1
     
    Inspired by Eiffel

    View full-size slide

  47. Powered by Rabbit 2.2.1
     
    Icon (1970s, U of Arizona)

    View full-size slide

  48. Powered by Rabbit 2.2.1
     
    Success/Failure model

    View full-size slide

  49. Powered by Rabbit 2.2.1
     
    return

    View full-size slide

  50. Powered by Rabbit 2.2.1
     
    From C

    View full-size slide

  51. Powered by Rabbit 2.2.1
     
    Multiple values (Tuple)

    View full-size slide

  52. Powered by Rabbit 2.2.1
     
    self/super

    View full-size slide

  53. Powered by Rabbit 2.2.1
     
    Smalltalk

    View full-size slide

  54. Powered by Rabbit 2.2.1
     
    alias/undef

    View full-size slide

  55. Powered by Rabbit 2.2.1
     
    From Sather (1980s, UCB)

    View full-size slide

  56. Powered by Rabbit 2.2.1
     
    BEGIN/END

    View full-size slide

  57. Powered by Rabbit 2.2.1
     
    From Awk

    View full-size slide

  58. Powered by Rabbit 2.2.1
     
    Not recommendation anymore

    View full-size slide

  59. Powered by Rabbit 2.2.1
     
    __FILE__/__LINE__

    View full-size slide

  60. Powered by Rabbit 2.2.1
     
    From C (cpp)

    View full-size slide

  61. Powered by Rabbit 2.2.1
     
    __ENCODING__

    View full-size slide

  62. Powered by Rabbit 2.2.1
     
    From Ruby1.9 (encoding)

    View full-size slide

  63. Powered by Rabbit 2.2.1
     
    UCS vs CSI

    View full-size slide

  64. Powered by Rabbit 2.2.1
     
    Unicode

    View full-size slide

  65. Powered by Rabbit 2.2.1
     
    BDFL

    View full-size slide

  66. Powered by Rabbit 2.2.1
     
    Benevolent Dictator For Life

    View full-size slide

  67. Powered by Rabbit 2.2.1
     
    How to make decisions

    View full-size slide

  68. Powered by Rabbit 2.2.1
     
    Scope
    Background
    Motivation

    View full-size slide

  69. Powered by Rabbit 2.2.1
     
    Committee

    View full-size slide

  70. Powered by Rabbit 2.2.1
     
    Voting

    View full-size slide

  71. Powered by Rabbit 2.2.1
     
    A ship would climb a mountain
    with many captains

    View full-size slide

  72. Powered by Rabbit 2.2.1
     
    too many cooks spoil the broth

    View full-size slide