ArticleslgStudy

computer science

Pharo

Pharo is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Pharo rather than just read about it. In short: Pharo is a cross-platform implementation of the classic Smalltalk-80 programming language and runtime system. It is based on the OpenSmalltalk virtual machine (VM) named Cog, which evaluates a dynamic, reflective, and object-oriented programming language with a syntax closely resembling Smalltalk-80.

Pharo — main illustration
Pharo — illustration

Key takeaways

  • Pharo belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Pharo to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Pharo from memory before moving on to harder problems.

Reference excerpt

Pharo is a cross-platform implementation of the classic Smalltalk-80 programming language and runtime system. It is based on the OpenSmalltalk virtual machine (VM) named Cog, which evaluates a dynamic, reflective, and object-oriented programming language with a syntax closely resembling Smalltalk-80. It is free and open-source software, released under a mix of MIT, and Apache 2 licenses. Pharo is shipped with source code compiled into a system image that contains all software needed to run Pharo. Like the original Smalltalk-80, Pharo provides several live programming features such as immediate object manipulation, live updates, and just-in-time compilation (JIT). The system image includes an integrated development environment (IDE) to modify its components. Pharo was forked from Squeak v3.9 in March 2008.

Overview Pharo is a pure object-oriented, dynamically typed, and reflective language. The stated project goal is to revisit Smalltalk design and enhance it. The name Pharo comes from the French word "phare" (French pronunciation: [faʁ]) which means lighthouse. This is why the Pharo logo shows a drawing of a lighthouse inside the final letter O of the name.

Key features

Virtual machine Multiplatform virtual machine with just-in-time compilation (JIT), combined generational garbage collector, ephemerons, forwarders Fast object enumeration Easy call stack manipulation AST metalinks Relatively low memory consumption Customizable compiler Optional complete object memory persistence Resumable exceptions Fast object serialization

Built-in software Optional fusion of developed program and development environment Live object inspection

Language features Simple syntax Object-oriented programming Immediate object identity swapping Dynamic inheritance Objects as methods Optional Green threads Customizable metaclasses Easy to use proxy objects

Relation to Smalltalk Pharo is based on general concepts of Smalltalk but seeks to improve on them, so does not limit itself to them. The basic syntax of the language has a close resemblance to Smalltalk. However, the way classes are defined in Pharo differs from other Smalltalk dialects.

Language syntax

The Pharo syntax is based on Smalltalk-80 language syntax with several extensions. Some of these are common among modern Smalltalk dialects.

literals for dynamic arrays. The expressions that specify the array content are evaluated during program execution

literals for byte arrays that can be composed only of integer numbers in the range from 0 to 255

literals for scaled decimals, a representation of fixed point decimal numbers able to accurately represent decimal fractions

pragmas. In Smalltalk-80 the pragmas are used only for primitive methods. In Pharo they are fully capable method annotations

two double quotes inside a comment are interpreted as one double quote character that is part of the content of the comment The Pharo language syntax is supposed to be very simple and minimalist. The basic language elements are often presented on one postcard as a showcase for the language's brevity. The grammar is classified as LL(1). The language grammar does not specify directly how the code should be stored in files. Pharo uses Tonel as the preferred code serialization format.

History

Pharo emerged as a fork of Squeak, an open-source Smalltalk environment created by the original Smalltalk-80 team (Dan Ingalls and Alan Kay). Pharo was created by S. Ducasse [1] and M. Denker in March 2008. It focuses on modern software engineering and development techniques. Pharo is supported by the Pharo consortium (for legal entities) [2] and the Pharo association for physical persons [3].

Use of Pharo

Companies and consultants Some companies use Pharo for their development projects. In particular, they use:

Seaside for dynamic web development Zinc for server architectures Moose to analyse data and software from all programming languages Graphic libraries for evolved user interfaces Roassal to visualize data The Pharo consortium was created for companies wishing to support the Pharo project. The Pharo association was created in 2011 for users wishing to support the project.

Performance and virtual machine (VM) Pharo relies on a virtual machine that is written almost entirely in Smalltalk. Beginning in 2008, a new virtual machine (Cog) for Squeak, Pharo and Newspeak has been developed that performs nearly as well as the fastest Smalltalk virtual machine. In 2014/2015 the VM community is working on Spur, a new Memory Manager for Cog that should again increase performance and provide better 64-bit VM support.

See also

Amber Smalltalk GNU Smalltalk VisualWorks Seaside_(software)

References

External links Official website

Illustrations

Pharo illustration
Pharo illustration
Pharo: Pharo syntax postcard
Pharo syntax postcard
Pharo illustration

Worked examples

Example 1 — a first encounter with Pharo

Start with the simplest possible case. Write down what Pharo claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Pharo before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Pharo ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Pharo

In research
Pharo appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Pharo in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Pharo is common in secondary-school and first-year university syllabi. It links to neighbouring topics 2008 software, Class-based programming languages, Cross-platform free software, so understanding it makes those chapters shorter.
In everyday life
Look for Pharo outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Pharo in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Pharo means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Pharo out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Pharo in simple terms?

Pharo is a cross-platform implementation of the classic Smalltalk-80 programming language and runtime system. It is based on the OpenSmalltalk virtual machine (VM) named Cog, which evaluates a dynamic, reflective, and object-oriented programming language with a syntax closely resembling Smalltalk-8…

Why does Pharo matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Pharo?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Pharo.

Tags

  • 2008 software
  • Class-based programming languages
  • Cross-platform free software
  • Dynamically typed programming languages
  • Free and open source compilers
  • Object-oriented programming languages
  • Programming languages
  • Programming languages created in 2008
  • Smalltalk programming language family
  • Software using the Apache license
  • Software using the MIT license

Keep exploring