Building Ruby in Smalltalk
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Building Ruby in Smalltalk

on

  • 813 views

Martin McClure: Building Ruby in

Martin McClure: Building Ruby in
Smalltalk. ESUG 2010, Barcelona, Spain

Statistics

Views

Total Views
813
Views on SlideShare
813
Embed Views
0

Actions

Likes
1
Downloads
8
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

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

Building Ruby in Smalltalk Presentation Transcript

  • 1. Building Ruby in Smalltalk Martin McClure ESUG 2009
  • 2. Why?
  • 3.
  • 4. ...and more
  • 5. GemStone for Really Smart Dummies
  • 6. GemStone/S ● Smalltalk Implementation ● Headless ● Shared transactional persistence – Shared “image” – Commit merges concurrent changes – Large ● Thousands of concurrent VMs ● Terabyte scale – Fast ● 10K commits/sec
  • 7. GemStone/S It's Just Smalltalk
  • 8. The Big Choice
  • 9. Challenge 1: The Compiler
  • 10. Smalltalk Grammar
  • 11. Ruby Grammar
  • 12. Ruby 1.8.6 parse.y
  • 13. Ruby 1.8.6 parse.y
  • 14. Cheat
  • 15. Challenge 2: Arity
  • 16. Arity Challenges ● Number of message send arguments and method definition parameters may be different. ● '*' Argument and parameter – Array expansion for variable arity ● '&' block passing ● Smalltalk VM expects sender and receiver arity to always be fixed and to match
  • 17. Cheat
  • 18. Synthetic 'Bridge' Methods ● def foo(a,*b) … end ● Compiles: foo, foo*, foo&, foo*&, foo:, foo:*, foo:&, foo:*& foo::, foo::*, foo::&, foo::*& foo:::, foo:::*, foo:::&, foo:::*&
  • 19. Synthetic 'Bridge' Methods ● some_object.foo(a,b,*c) compiles a send to selector foo::* ● Bridge method foo::* adapts number of arguments and resends to actual foo variant
  • 20. Challenge 3: Coexistence of Ruby and Smalltalk
  • 21. Immediate Classes
  • 22. Not Cheat
  • 23. Environment-specific behavior ● Method dictionary per class per environment ● Each send site specifies an environment ● Complicates full method lookup ● Does not affect send-site caches
  • 24. Challenge 4: Per-instance Behavior
  • 25. Challenge 5: Per-instance Variables
  • 26. In Ruby, an instance variable is created by the act of assigning to it.
  • 27. Possible instvars are hard to find class MyExample def initialize(someValue) @my_instvar = someValue end end … class MyExample def setAlpha(newAlpha) @alpha = newAlpha end end
  • 28. Core Tests Passed Over Time
  • 29. Did we make the right choice?
  • 30. Yes We Did
  • 31. Cheat
  • 32. Not cheating at all, really
  • 33. Thank You Questions?