Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Kink: developing a programming language on the JVM

1,061 views

Published on

JRubyKaigi 2010のライトニングトーク資料です。

Kinkという、JVM上のプログラミング言語を紹介しています。

Published in: Technology
  • Be the first to comment

Kink: developing a programming language on the JVM

  1. 1. 2010-08-28 Kink: developing a programming language on the JVM @miyakawa taku
  2. 2. What is Kink • A programming language on the JVM • Hosted on Google Code – http://code.google.com/p/kink-lang/
  3. 3. What kind of language • Prototype-based – No classes, only constructor methods – Like Lua and JavaScript • Functional (not purely) – First-class lambda – List processing methods – Like Lisps, especially Scheme
  4. 4. Bank account example &account = { %[ &INITIAL = 0 ] &BALANCE = INITIAL value( ’balance’ : { BALANCE } ’withdraw’ : { &BALANCE << BALANCE - __ } ’deposit’ : { &BALANCE << BALANCE + __ } ) } &MY_ACCOUNT = account( 100 ) MY_ACCOUNT.deposit( 32.5 ) MY_ACCOUNT.balance.dump # => 132.5
  5. 5. Swing example @use ’Java’ @use_class ’javax.swing.JFrame’ @use_class ’javax.swing.JButton’ @use_class ’javax.swing.JOptionPane’ &BUTTON = JButton.new( ’Push me’ ) BUTTON.addActionListener {{ JOptionPane.showMessageDialog( null ’Pushed!’ ) }} &FRAME = JFrame.new( "Swingin’" ) FRAME.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ) FRAME.getContentPane.add( BUTTON ) FRAME.pack FRAME.setVisible( true )
  6. 6. Pros and cons • Pros: simple semantics/syntax – No classes – No semicolons and no commas – Easy-to-write lambda: { * 2 } • Cons: VERY slow – time tak(12, 6, 0) JRuby 1.4 5 seconds Kink 246 seconds – But also JRuby WAS very slow
  7. 7. What is great about JRuby • Performance • Compatibility – With MRI and POSIX – Write many, run anywhere!
  8. 8. Developing a language on the JVM • Good way to learn Java SE, JVM, and programming – Class loading – Byte code generation – Design patterns • Write your language, it’s fun!

×