The Pharo Programming Language

20
http://www.pharo-project.org

description

Pharo is a Smalltalk dialect programming language. From the pharo-project.org website:"Pharo's goal is to deliver a clean, innovative, open-source Smalltalk environment. By providing a stable and small core system, excellent developer tools, and maintained releases, Pharo is an attractive platform to build and deploy mission critical Smalltalk applications. Pharo is MIT licensed and is steered by a board of benevolent dictators. The board makes final decisions if no consensus can be reached within the community. Pharo fosters a healthy ecosystem of both private and commercial contributors who advance and maintain the core system and its external packages."

Transcript of The Pharo Programming Language

Page 1: The Pharo Programming Language

http://www.pharo-project.org

Page 2: The Pharo Programming Language

Pharo in a nutshell

• Pharo = language + IDE + update mechanism

• Pure object-oriented programming language

• Dynamically typed and trait-based

• Open and flexible environment (OB, Polymorph, Scripting)

• Using as executing platform for Seaside and Aida/Web web frameworks

Page 3: The Pharo Programming Language

Getting started with Pharo

Page 4: The Pharo Programming Language

Everything is an object

Page 5: The Pharo Programming Language

Everything happens by sending messages to objects

Page 6: The Pharo Programming Language

Running Pharo

Page 7: The Pharo Programming Language

Do it, print it

You can evaluateany expression

anywherein Pharo

Page 8: The Pharo Programming Language

Standard development tools

Page 9: The Pharo Programming Language

Standard development tools

Page 10: The Pharo Programming Language

Debugger, explorer, inspector

Page 11: The Pharo Programming Language

Syntax in a nutshell

Page 12: The Pharo Programming Language

3 kinds of messages

Unary messages

Binary messages

Keywords messages

5 factorialTranscript cr

3 + 4

3 raisedTo: 10 modulo: 5

Transcript show: 'hello world'

Page 13: The Pharo Programming Language

<= aPoint "Answer whether the receiver is neither below nor to the right of aPoint."

^ x <= aPoint x and: [y <= aPoint y]

A typical method in Point

Method name Argument Comment

Return Binary messageKeyword messageInstance variable

Block

(2@3) <= (5@6) true

Page 14: The Pharo Programming Language

| p pen |p := [email protected] := Pen new.pen up.pen goto: p; down; goto: p+p

Statement and cascades

Temporary variablesStatement

Cascade

Page 15: The Pharo Programming Language

Control structures

Every control structure is realized by message sends

4 timesRepeat: [Beeper beep]

max: aNumber ^ self < aNumber ifTrue: [aNumber] ifFalse: [self]

Page 16: The Pharo Programming Language

Control structures

Every control structure is realized by message sends

4 timesRepeat: [Beeper beep]

max: aNumber ^ self < aNumber ifTrue: [aNumber] ifFalse: [self]

ifTrue:ifFalse:

Boolean

ifTrue:ifFalse:

True

ifTrue:ifFalse:

False

ifTrue: t ifFalse: f

^ t value

ifTrue: t ifFalse: f

^ f value

Page 17: The Pharo Programming Language

Creating classes

Send a message to a class (!)

Number subclass: #Complex instanceVariableNames: 'real imaginary' classVariableNames: '' poolDictionaries: '' category: 'ComplexNumbers'

Page 18: The Pharo Programming Language

Be involved! Join Pharo

• Strong community

• Goal: learning and having fun

• We need forces on several topics: graphics programming, compilation, virtual machines

Page 19: The Pharo Programming Language

Links

• Webpage: http://www.pharo-project.org

• Download: http://www.pharo-project.org/download

• Mailing list: http://gforge.inria.fr/mail/?group_id=1299

Page 20: The Pharo Programming Language