keynote-101114132839-phpapp02

Upload: jmbajet

Post on 07-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/4/2019 keynote-101114132839-phpapp02

    1/89

    Keynote Powered by Rabbit 0.9.1

    Keynote

    Yukihiro "Matz" Matsumoto

    @yukihiro_matz

  • 8/4/2019 keynote-101114132839-phpapp02

    2/89

    Keynote Powered by Rabbit 0.9.1

    Acknowledgment

    In memory of

    Guy Decoux

    _why the lucky stiff

    Zed Shaw

    1/88

  • 8/4/2019 keynote-101114132839-phpapp02

    3/89

    Keynote Powered by Rabbit 0.9.1

    Today's Menu

    History

    Future

    Diversity

    2/88

  • 8/4/2019 keynote-101114132839-phpapp02

    4/89

    Keynote Powered by Rabbit 0.9.1

    History

    10th Annual RubyConf

    3/88

  • 8/4/2019 keynote-101114132839-phpapp02

    5/89

    Keynote Powered by Rabbit 0.9.1

    History

    9 Keynotes by me

    4/88

  • 8/4/2019 keynote-101114132839-phpapp02

    6/89

    Keynote Powered by Rabbit 0.9.1

    2001

    Tampa, FL

    5/88

  • 8/4/2019 keynote-101114132839-phpapp02

    7/89Keynote Powered by Rabbit 0.9.1

    2001

    Human-OrientedProgramming in Ruby

    6/88

  • 8/4/2019 keynote-101114132839-phpapp02

    8/89Keynote Powered by Rabbit 0.9.1

    2002

    Seattle, WA

    7/88

  • 8/4/2019 keynote-101114132839-phpapp02

    9/89Keynote Powered by Rabbit 0.9.1

    2002

    Be Minor, Be Cool

    8/88

  • 8/4/2019 keynote-101114132839-phpapp02

    10/89Keynote Powered by Rabbit 0.9.1

    2003

    Austin, TX

    9/88

  • 8/4/2019 keynote-101114132839-phpapp02

    11/89Keynote Powered by Rabbit 0.9.1

    2003

    Visions for the Future

    How Ruby Sucks

    10/88

  • 8/4/2019 keynote-101114132839-phpapp02

    12/89Keynote Powered by Rabbit 0.9.1

    2004

    Chantilly, VA

    11/88

  • 8/4/2019 keynote-101114132839-phpapp02

    13/89Keynote Powered by Rabbit 0.9.1

    2004

    12/88

  • 8/4/2019 keynote-101114132839-phpapp02

    14/89Keynote Powered by Rabbit 0.9.1

    2004

    13/88

  • 8/4/2019 keynote-101114132839-phpapp02

    15/89Keynote Powered by Rabbit 0.9.1

    2005

    San Diego, CA

    14/88

  • 8/4/2019 keynote-101114132839-phpapp02

    16/89Keynote Powered by Rabbit 0.9.1

    2005

    Visions for the Future

    Wild and Weird Ideas

    15/88

  • 8/4/2019 keynote-101114132839-phpapp02

    17/89

  • 8/4/2019 keynote-101114132839-phpapp02

    18/89

    Keynote Powered by Rabbit 0.9.1

    2006

    The Return of the Bikeshedor Nuclear Plant in the

    Backyard

    17/88

  • 8/4/2019 keynote-101114132839-phpapp02

    19/89

    Keynote Powered by Rabbit 0.9.1

    2007

    Charlotte, NC

    18/88

  • 8/4/2019 keynote-101114132839-phpapp02

    20/89

    Keynote Powered by Rabbit 0.9.1

    2007

    Language Matters

    19/88

  • 8/4/2019 keynote-101114132839-phpapp02

    21/89

    Keynote Powered by Rabbit 0.9.1

    2008

    Orlando, FL

    20/88

  • 8/4/2019 keynote-101114132839-phpapp02

    22/89

    Keynote Powered by Rabbit 0.9.1

    2008

    Reasons behind Ruby

    21/88

  • 8/4/2019 keynote-101114132839-phpapp02

    23/89

    Keynote Powered by Rabbit 0.9.1

    2009

    San Francisco, CA

    22/88

  • 8/4/2019 keynote-101114132839-phpapp02

    24/89

    Keynote Powered by Rabbit 0.9.1

    2009

    The 0.8 True Language (ZEPT)

    23/88

  • 8/4/2019 keynote-101114132839-phpapp02

    25/89

  • 8/4/2019 keynote-101114132839-phpapp02

    26/89

    Keynote Powered by Rabbit 0.9.1

    2010

    Future and Diversity

    25/88

  • 8/4/2019 keynote-101114132839-phpapp02

    27/89

    Keynote Powered by Rabbit 0.9.1

    Future and Diversity

    26/88

  • 8/4/2019 keynote-101114132839-phpapp02

    28/89

    Keynote Powered by Rabbit 0.9.1

    The Future

    27/88

  • 8/4/2019 keynote-101114132839-phpapp02

    29/89

  • 8/4/2019 keynote-101114132839-phpapp02

    30/89

    Keynote Powered by Rabbit 0.9.1

    Ruby 2.0

    Traits

    Method Combination

    Keyword arguments

    Namespaces

    a few other nifty features

    29/88

  • 8/4/2019 keynote-101114132839-phpapp02

    31/89

    Keynote Powered by Rabbit 0.9.1

    Traits

    trait

    a trait is a collection of methods,used as a "simple conceptualmodel for structuring objectoriented programs".

    from Wikipedia (en)

    30/88

  • 8/4/2019 keynote-101114132839-phpapp02

    32/89

    Keynote Powered by Rabbit 0.9.1

    What's wrong for

    Modules?

    Conflict detection

    Conflict resolution

    Tree modification

    No method combination

    31/88

  • 8/4/2019 keynote-101114132839-phpapp02

    33/89

    Keynote Powered by Rabbit 0.9.1

    Conflict Detection

    name conflict

    intentional (overriding)?

    or accidental?

    32/88

  • 8/4/2019 keynote-101114132839-phpapp02

    34/89

    Keynote Powered by Rabbit 0.9.1

    Conflict Problem

    module Americanattr_accessor :address

    endmodule Japanese

    attr_accessor :addressendclass JapaneseAmerican include American include JapaneseendJapaneseAmerican.new.address# which address?p JapaneseAmerican.ancestors# => [JapaneseAmerican, Japanese, American, Object, Kernel]

    33/88

  • 8/4/2019 keynote-101114132839-phpapp02

    35/89

    Keynote Powered by Rabbit 0.9.1

    Solution

    We will introduce #mix

    #mix will replace #include

    #mix can detect and

    resolve conflict

    34/88

  • 8/4/2019 keynote-101114132839-phpapp02

    36/89

    Keynote Powered by Rabbit 0.9.1

    Module#mix

    injects the current snapshotinto other class/module.

    raises error when nameconflict

    unless you resolve itexplicitly

    35/88

  • 8/4/2019 keynote-101114132839-phpapp02

    37/89

    Keynote Powered by Rabbit 0.9.1

    Conflict Problem

    module Americanattr_accessor :address

    end

    module Japaneseattr_accessor :address

    endclass JapaneseAmerican

    # Japanese comes First include American include Japaneseend

    36/88

  • 8/4/2019 keynote-101114132839-phpapp02

    38/89

    Keynote Powered by Rabbit 0.9.1

    Detecting Conflict

    module Americanattr_accessor :address

    endmodule Japaneseattr_accessor :address

    endclass JapaneseAmerican

    mix Americanmix Japanese # => address conflict!

    end

    37/88

  • 8/4/2019 keynote-101114132839-phpapp02

    39/89

    Keynote Powered by Rabbit 0.9.1

    Resolving Conflict

    class JapaneseAmericanmix American, :address => :us_addressmix Japanese, :address => :jp_address

    end

    38/88

  • 8/4/2019 keynote-101114132839-phpapp02

    40/89

    Keynote Powered by Rabbit 0.9.1

    Tree Modification

    module M1; endclass C1; include M1; end

    module M2; end

    module M1; include M2; end

    p C1.ancestors# [C1, M1, Object, Kernel]

    p M1.ancestors# [M1, M2]

    inconsistent 39/88

  • 8/4/2019 keynote-101114132839-phpapp02

    41/89

    Keynote Powered by Rabbit 0.9.1

    Tree Modification

    #mix copies attributes

    so tree modificationafterward does not affect.

    consistent at leaset

    40/88

  • 8/4/2019 keynote-101114132839-phpapp02

    42/89

    Keynote Powered by Rabbit 0.9.1

    alias_method_chain

    ugly

    fragile to multiple wrapping

    we want to wrap methods

    41/88

  • 8/4/2019 keynote-101114132839-phpapp02

    43/89

    Keynote Powered by Rabbit 0.9.1

    Module#prepend

    We will introduce #prepend

    #prepend put the module

    before the current class/module

    methods defined in theclass will wrap methods ofsame names

    42/88

  • 8/4/2019 keynote-101114132839-phpapp02

    44/89

    Keynote Powered by Rabbit 0.9.1

    Module#prepend

    module Foo deffoo

    p :before super

    p :after endendclass Bar deffoo

    p :foo

    endprepend Foo

    endBar.new.foo # :before, :foo, :after

    43/88

  • 8/4/2019 keynote-101114132839-phpapp02

    45/89

    Keynote Powered by Rabbit 0.9.1

    Keyword Arguments

    calling

    1.step(by: 2, to: 20) do |i|p i

    end

    44/88

  • 8/4/2019 keynote-101114132839-phpapp02

    46/89

    Keynote Powered by Rabbit 0.9.1

    Keyword Arguments

    defining

    defstep(by: step, to: limit)...

    end

    45/88

  • 8/4/2019 keynote-101114132839-phpapp02

    47/89

    Keynote Powered by Rabbit 0.9.1

    Keyword Arguments

    Mere expanded hashargument at the end

    Automatic decomposition

    46/88

  • 8/4/2019 keynote-101114132839-phpapp02

    48/89

    Keynote Powered by Rabbit 0.9.1

    Namespaces

    encapsulation of monkeypatching

    monkey patching is globalmodification

    embodies freedom, butdangerous

    47/88

  • 8/4/2019 keynote-101114132839-phpapp02

    49/89

    Keynote Powered by Rabbit 0.9.1

    Namespaces

    encapsulation of monkey

    patchingclasssbox / selectornamespace / refinement /

    whatever

    48/88

  • 8/4/2019 keynote-101114132839-phpapp02

    50/89

    Keynote Powered by Rabbit 0.9.1

    What if

    class Integer

    def/(other) return quo(other) endendp 1/2 # => (1/2)

    49/88

  • 8/4/2019 keynote-101114132839-phpapp02

    51/89

  • 8/4/2019 keynote-101114132839-phpapp02

    52/89

    Keynote Powered by Rabbit 0.9.1

    Using Refinement

    module Rationalize

    using MathNp 1/2 # => (1/2)

    end

    p 1/2 # => 0

    51/88

  • 8/4/2019 keynote-101114132839-phpapp02

    53/89

    Keynote Powered by Rabbit 0.9.1

    Real Private Methods

    class HasPrivate module Private defpriv end

    endusing Private defpub

    priv endend

    h = HasPrivate.newh.priv # => errorh.instance_eval {priv # => error

    }

    52/88

  • 8/4/2019 keynote-101114132839-phpapp02

    54/89

    Keynote Powered by Rabbit 0.9.1

    FAQ

    When will they be available?

    Ruby 2.0

    53/88

  • 8/4/2019 keynote-101114132839-phpapp02

    55/89

    Keynote Powered by Rabbit 0.9.1

    FAQ

    When will Ruby2.0 be?Christmas

    on whatever year!

    54/88

  • 8/4/2019 keynote-101114132839-phpapp02

    56/89

    Keynote Powered by Rabbit 0.9.1

    Diversity

    55/88

  • 8/4/2019 keynote-101114132839-phpapp02

    57/89

    Keynote Powered by Rabbit 0.9.1

    I love Diversity

    56/88

  • 8/4/2019 keynote-101114132839-phpapp02

    58/89

    Keynote Powered by Rabbit 0.9.1

    I dislike Diversity

    57/88

  • 8/4/2019 keynote-101114132839-phpapp02

    59/89

    Keynote Powered by Rabbit 0.9.1

    The Ruby Language

    specification

    implementation

    58/88

    h b

  • 8/4/2019 keynote-101114132839-phpapp02

    60/89

    Keynote Powered by Rabbit 0.9.1

    The Ruby Language

    specification

    Standard Ruby (ISO)

    RubySpec

    59/88

    h b

  • 8/4/2019 keynote-101114132839-phpapp02

    61/89

    Keynote Powered by Rabbit 0.9.1

    The Ruby Language

    implementation

    CRuby

    JRuby

    Rubinius

    MagLev

    ...

    60/88

    Al i fill h

  • 8/4/2019 keynote-101114132839-phpapp02

    62/89

    Keynote Powered by Rabbit 0.9.1

    Alternative to fill the

    Niche

    JRuby for JVM

    MacRuby for Mac

    MagLev for GemStone

    Ruboto for Android

    61/88

    Y h Ni h

  • 8/4/2019 keynote-101114132839-phpapp02

    63/89

    Keynote Powered by Rabbit 0.9.1

    Yet another Niche

    Embedding

    62/88

    Rit

  • 8/4/2019 keynote-101114132839-phpapp02

    64/89

    Keynote Powered by Rabbit 0.9.1

    Rite

    The New Comer

    Light weight implmentation

    of usable subset of the

    Ruby language

    63/88

    T t

  • 8/4/2019 keynote-101114132839-phpapp02

    65/89

    Keynote Powered by Rabbit 0.9.1

    Target

    Embedding

    Small devices

    Digital Appliances

    Applications (Game?)

    and more

    64/88

    E b dd bl R b

  • 8/4/2019 keynote-101114132839-phpapp02

    66/89

    Keynote Powered by Rabbit 0.9.1

    Embeddable Ruby

    think of Lua

    with better language

    65/88

    P i i l

  • 8/4/2019 keynote-101114132839-phpapp02

    67/89

    Keynote Powered by Rabbit 0.9.1

    Principle

    Components

    Configurable

    66/88

    C t

  • 8/4/2019 keynote-101114132839-phpapp02

    68/89

    Keynote Powered by Rabbit 0.9.1

    Componentsthe implementation will becombination of components

    parser

    virtual machine

    garbage collector

    debugger

    class libraries67/88

    C fi bl

  • 8/4/2019 keynote-101114132839-phpapp02

    69/89

    Keynote Powered by Rabbit 0.9.1

    Configurable

    to minimal set of featuresrequired for an application

    no universal behaviorbetween platforms

    e.g. no file I/O for small devices

    68/88

    C fi bl

  • 8/4/2019 keynote-101114132839-phpapp02

    70/89

    Keynote Powered by Rabbit 0.9.1

    Configurable

    use double or float

    use int, long or long long forfixnums

    ASCII or UTF-8

    69/88

    R i t

  • 8/4/2019 keynote-101114132839-phpapp02

    71/89

    Keynote Powered by Rabbit 0.9.1

    Requirement

    portableminimal requirement: standardC (C99)

    should run on PC / RTOS /free standing

    less memory

    less latency70/88

    I l t i D t il

  • 8/4/2019 keynote-101114132839-phpapp02

    72/89

    Keynote Powered by Rabbit 0.9.1

    Implementaion Detail

    register-based virtualmachine

    32bit word-code

    floats are immediate

    (possibly generational)incremental mark-sweep GC

    71/88

    What can I do ith Rite?

  • 8/4/2019 keynote-101114132839-phpapp02

    73/89

    Keynote Powered by Rabbit 0.9.1

    What can I do with Rite?

    embedding

    application embedding

    small devices

    e.g. digital TV

    72/88

    What can I do with Rite?

  • 8/4/2019 keynote-101114132839-phpapp02

    74/89

    Keynote Powered by Rabbit 0.9.1

    What can I do with Rite?

    concurrentassign virtual machine for eachthread

    73/88

    the Ruby chip

  • 8/4/2019 keynote-101114132839-phpapp02

    75/89

    Keynote Powered by Rabbit 0.9.1

    the Ruby chip

    by Prof. Tanaka from KyushuInstitute of Technology

    MIPS-like FPGA CPU with afew instructions added

    that help method look-up

    and garbage collection marking

    74/88

    FAQ

  • 8/4/2019 keynote-101114132839-phpapp02

    76/89

    Keynote Powered by Rabbit 0.9.1

    FAQ

    When will Rite available?

    I don't know, sorry.But it's a part of Japanesegovernment funded two

    year project (2010-2011)

    75/88

    FAQ

  • 8/4/2019 keynote-101114132839-phpapp02

    77/89

    Keynote Powered by Rabbit 0.9.1

    FAQ

    Will Rite be Open-Source?

    Yes, probably underMIT license.

    But we need business

    model to satisfy thegovernment.

    76/88

    FAQ

  • 8/4/2019 keynote-101114132839-phpapp02

    78/89

    Keynote Powered by Rabbit 0.9.1

    FAQ

    Will Rite be Open-Source?

    We might choose GPL pluscommercial subscription

    model (a la MySQL).

    77/88

    FAQ

  • 8/4/2019 keynote-101114132839-phpapp02

    79/89

    Keynote Powered by Rabbit 0.9.1

    FAQ

    Will Rite replace MRI?

    No, Rite will not be a full-featured, universal

    implementation.

    78/88

    FAQ

  • 8/4/2019 keynote-101114132839-phpapp02

    80/89

    Keynote Powered by Rabbit 0.9.1

    FAQ

    Will Rite replace MRI?

    It is a Domain SpecificImplementation, like

    Ruboto.

    79/88

    FAQ

  • 8/4/2019 keynote-101114132839-phpapp02

    81/89

    Keynote Powered by Rabbit 0.9.1

    FAQ

    How about C API?

    Rite will have different CAPI from CRuby.

    Currently we have no plan

    to provide compatibilitylayer.

    80/88

    FAQ

  • 8/4/2019 keynote-101114132839-phpapp02

    82/89

    Keynote Powered by Rabbit 0.9.1

    FAQ

    Will Rite support M17N?

    No, you have to configuresingle character encoding

    from ASCII or UTF-8 in

    compile time.

    81/88

    FAQ

  • 8/4/2019 keynote-101114132839-phpapp02

    83/89

    Keynote Powered by Rabbit 0.9.1

    FAQ

    Will Rite support (native)threads?

    No, to use threads you canuse multiple VM per nativethreads. Rite may support

    fibers in the future.

    82/88

  • 8/4/2019 keynote-101114132839-phpapp02

    84/89

    FAQ

  • 8/4/2019 keynote-101114132839-phpapp02

    85/89

    Keynote Powered by Rabbit 0.9.1

    FAQ

    How can I contribute to Rite?

    Wait until we make it open-source. We will open it on

    github.

    84/88

    FAQ

  • 8/4/2019 keynote-101114132839-phpapp02

    86/89

    Keynote Powered by Rabbit 0.9.1

    FAQ

    Rite sounds familier

    Originally Rite was a codename for the first Ruby 2.0

    virtual machine, whichwas replaced by YARV. It's

    coind from Ruby Lite.

    85/88

    FAQ

  • 8/4/2019 keynote-101114132839-phpapp02

    87/89

    Keynote Powered by Rabbit 0.9.1

    FAQ

    Do you resign from CRuby?

    No, but I have spent lesstime on CRuby recently

    anyway.

    86/88

    FAQ

  • 8/4/2019 keynote-101114132839-phpapp02

    88/89

    Keynote Powered by Rabbit 0.9.1

    FAQ

    Do you resign from CRuby?

    I will keep being a

    maintainer of CRuby. Andabove all, I will keep being

    active as the creator of

    the language and, theleader of the community.

    87/88

  • 8/4/2019 keynote-101114132839-phpapp02

    89/89

    Thank you!