Skip to main content
Engineering LibreTexts

2.2: Pharo — File Components

  • Page ID
    39571
    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Pharo consists of four main component files. Although you do not need to deal with them directly for the purposes of this book, it is useful to understand the roles they play.

    1. The virtual machine (VM) is the only component that is different for each operating system. The VM is the execution engine (similar to a JVM). It takes Pharo bytecode that is generated each time user compiles a piece of code, converts it to machine code and executes it. Pharo comes with the Cog VM a very fast JITing VM. The VM executable is named:

      • Pharo.exe for Windows;
      • pharo for Linux; and
      • Pharo for OSX (inside a package also named Pharo.app).

      The other components below are portable across operating systems, and can be copied and run on any appropriate virtual machine.

    2. The sources file contains source code for parts of Pharo that don’t change frequently. Sources file is important because the image file format stores only objects including compiled methods and their bytecode and not their source code. Typically a new sources file is generated once per major release of Pharo. For Pharo 5.0, this file is named PharoV50.sources.

    3. The changes file logs of all source code modifications (especially all the changes you did while programming) since the .sources file was generated. Each release provides a near empty file named for the release, for example Pharo5.0.changes. This facilitates a per method history for diffs or reverting. It means that even if you did not manage to save the image file on a crash or you just forgot, you can recover your changes from this file. A changes file is always coupled with a image file. They work in pair.

    4. The image file provides a frozen in time snapshot of a running Pharo system. This is the file where all objects are stored and as such it’s a cross platform format. An image file contains the live state of all objects of the system (including classes and compiled methods, since they are objects too) at a given point. An image is a virtual object container. The file is named for the release (like Pharo5.0.image) and it is synched with the Pharo5.0.changes file.

    Image/Change pair

    The .image and .changes files provided by a Pharo release are the starting point for a live environment that you adapt to your needs. As you work in Pharo, these files are modified, so you need to make sure that they are writable. Pay attention to remove the changes and image files from the list of files to be checked by anti-viruses. The .image and .changes files are intimately linked and should always be kept together, with matching base filenames. Never edit them directly with a text editor, as .images holds your live object runtime memory, which indexes into the .changes files for the source. It is a good idea to keep a backup copy of the downloaded .image and .changes files so you can always start from a fresh image and reload your code. However, the most efficient way for backing up code is to use a version control system that will provide an easier and powerful way to back up and track your changes.

    Common setup

    The four main component files above can be placed in the same directory, but it’s a common practice to put the Virtual Machine and sources file in a separate directory where everyone has read-only access to them.

    Do whatever works best for your style of working and your operating system.


    This page titled 2.2: Pharo — File Components is shared under a CC BY-SA 3.0 license and was authored, remixed, and/or curated by via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.