Lecture19 - Dynamic Languages Lecture 19 CS 501 6/3/2009...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
Dynamic Languages Lecture 19 CS 501 6/3/2009
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Preliminaries • Critiques An Efficient Implementation of Self, a dynamically-typed object-oriented language based on prototypes Chambers, et al Tracing for web 3.0: trace compilation for the next generation web applications Chang, et al • HW3 due Friday
Background image of page 2
Dynamic Typing JavaScript: function foo(a, b) { t1 = a.x; // runtime field lookup t2 = b.y(); // runtime method lookup t3 = t1 + t2; // runtime dispatch on ‘+’ return t3; }
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Overview • Self – 20+ year old research language – One of earliest JIT compilation systems – Pioneered techniques used today • JavaScript – Self with a Java syntax – Much recent work to optimize
Background image of page 4
Self • Prototype-based pure object-oriented language. • Designed by Randall Smith (Xerox PARC) and David Ungar (Stanford University). – Successor to Smalltalk-80. – “Self: The power of simplicity” appeared at OOPSLA ‘87. – Initial implementation done at Stanford; then project shifted to Sun Microsystems Labs. – Vehicle for implementation research. • Self 4.2 available from Sun web site Slides adapted from Kathleen Fisher
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
• Occam’s Razor: Conceptual economy – Everything is an object. – Everything done using messages. – No classes – No variables • Concreteness – Objects should seem “real.” – GUI to manipulate objects directly Design Goals
Background image of page 6
How successful? • Self is a very well-designed language. • Few users: not a popular success – Not clear why. • However, many research innovations – Very simple computational model. – Enormous advances in compilation techniques. – Influenced the design of Java compilers.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Language Overview • Dynamically typed. • Everything is an object. • All computation via message passing. • Creation and initialization done by copying example object. • Operations on objects: – send messages – add new slots – replace old slots – remove slots
Background image of page 8
Objects and Slots Object consists of named slots. – Data • Such slots return contents upon evaluation; so act like variables – Assignment • Set the value of associated slot – Method • Slot contains Self code – Parent • References existing object to inherit slots
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Messages and Methods When message is sent, object searched for slot with name. If none found, all parents are searched. – Runtime error if more than one parent has a slot with the same name.
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 41

Lecture19 - Dynamic Languages Lecture 19 CS 501 6/3/2009...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online