Google Summer of Code 2017 Final Report – Pharo Consortium – Rajula Vineet Reddy


Finally, after three months of coding, discord, mailing list discussions, blogging, brain storming and documenting, my Google Sumer of Code 2017 Project comes to an end. This blog post is like a final report of my work covering what I have done over the past months and about the future work on my project.


Pharo is an object oriented programming language with a super cool live and immersive IDE. Pharo has a lot of awesome projects both in production phase and in development phase. Pharo has a really incredible community with contributors from around the world. It was a great experience working for Pharo, collaborating with the community over the last three months.

Project Details:

Title of the project is ‘Enhance Pharo Command Line Interface‘. The project is divided into three sections

  1. Writing a new implementation of the currentWorkingDirectory
  2. Pharo integration of the new implementation
  3. Writing a clap command line handler for clap-st

Overall, the project aims to improve the command line interface of Pharo thereby improving the capability of writing scripts in Pharo and building things on command line.


Guillermo Polito

Philippe Back


Initial Proposal:



(NOTE: The timeline described below should be approx. not exact )

I started to work on my project in the month of May itself. I spent a good amount of time trying to understand the existing implementation of working directory for my 1st goal. So, around June I was done with the first two goals of my project. The rest of June I spent understanding the existing code base of clap and collaborating with a fellow contributor who started working on clap way before me. By the mid of July I started to implement the handler. And I was almost done by the third week of August.

Goals Status

Writing a new implementation of the currentWorkingDirectory


Pharo integration of the new implementation

Partially completed except for File logging

Writing a clap command line handler for clap-st


Let me brief about what I have done in each of these goals.

  1. The new current working directory implementation

    In Pharo, the old currentWorkingDirectory implementation is not perfect and it has a few drawbacks because of which 

    • Pharo wrongly reads and writes files relative to the ‘working directory’
    • Pharo cannot be installed as a normal application in a read-only environment
    • And also makes scripting difficult

    The new implementation aims to solve all these drawbacks. Talking about the implementation. There were few options for a new implementation. They were

    • Using the PWD environment variable
    • Using getcwd() function

    If PWD variable is used to get the current working directory, though it can handle symlinks, PWD needs frequent update of its value when chdir() (change directory) calls are made in the code. Besides getcwd() needs no update. It takes care of itself. There is also a danger if $PWD variable is set or unset by some application. Also getcwd() function works in all unix, mac and windows systems as there is a similar function on all platforms. Hence I went for getcwd().

    The new implementation will consider the currentWorkingDirectory as the directory from where the image has been opened. The new implementation using FFI call to get the working directory. Using the C function getcwd() the working directory is captured and it is also cached to a class variable DefaultWorkingDirectory using Alistair`s caching approach.

    Now, with the new implementation, it is easier to write scripts and save files corresponding to the actual current working directory. Currently, this has not been merged yet, as FFI is not in the kernel and needs some core modifications in bootstrap.

  2. Pharo integration of working directory

    Since there is a lot of code which considers image directory as working directory, there may be a few cases where it can break interoperability between Pharo and other Smalltalk dialects like squeak etc. This means all of such code should be reviewed. In fact, some of these problems can be however bypassed by running image from its own directory itself or by using the method imageDirectory in FileLocator class explicitly when necessary. But overall a good thing is this will ensure the system will behave as in other languages.

    Few of the changes I did after review are creation of pharo-local directory and local iceberg repo. The new implementation creates pharo-local wherever the image is opened from. The creation of pharo-local should be restricted to the image directory.

    With this new implementation, FileOut will work relative to the working directory. With the new current working directory, saving and opening files will be corresponding to the ‘Actual’ working directory. So, the file outs now will save the file from where you have opened the image.

  3. Writing a clap command line handler for clap-st

    Clap-st is a command line argument parser for Pharo just like clap-rs. In fact it is inspired from clap-rs. The core part of clap has been developed by Damien Pollet and Clement Mastin. Clap takes arguments as input, parses it and makes it easy to run different things depending on the clap output. Initially I started with writing basic examples of clap-st  and later on I developed a ClapCommandLineHandler. This is like an interface between the clap-st and the command line. And clap is really green and lacks tests. So it needs a revisit of a parser of the general architecture to integrate it to the system and give way to test.

    By using clap-st it is easier to use flags, positionals, subcommands and commands. The handler takes input from command line, uses the clap-st to parse it and will print out the output back onto the commandline. Every new handler should be a child class of the ClapCommandLineHandler class. This way, the developer can be isolated and makes it easy to write his own handler. And to isolate the subclasses for production and testing, I implemented a strategy pattern, in such a way that the user can maintain his own collection of subclasses for testing. Check out the tutorial I made on how to create your handler.

A screencast video I made illustrating all the work I have done over the last few months.

Videos or Tutorials Made

Blog Posts

I have written a total of 12 blogposts (including this) over the last three months. The link to all the blogposts is . Though it was compulsory in my Org to write a blog post everyweek, I always enjoyed writing this. Instead of only writing about my progress, as my mentor Guille suggested I took on a topic every week to write on, through which I had to research and understand about the topic and I learned a lot in the progress.


Repositories worked on:

Pull Requests Made

As my work is more of implementing new things, rather than adding features to existing projects, do not expect a lot of PRs. JK. I have two PR`s for the work I have done. Most of my work was writing methods and classes from scratch so lot of time went into brainstorming how to implement.

  1. Current Working Directory – yet merged
    The new implementation I wrote uses ‘FFI’. And FFI is not in the current kernel of Pharo, so due to this dependency issue the PR is yet to merged. My mentor is looking for a solution to solve this problem. Hopefully soon this will be merged.
  2. ClapCommandLineHandler – Review
    This PR has been made a week ago. The collaborators of this repo and my mentor are currently on vacation. So, it takes some time to receive review and merge this pull request.

Learning and Experiences:

The journey of the last four months are the best in my life. May be the word I am looking for is ‘fantastic’. The Open source exposure I got from the programme is the best part. This is my ever open source contribution I did. And I am happy the contribution is for ‘Pharo’. This is a really great organization to work with. And I don`t think I can say anything about the community. Any questions at any point of the day will be answered some or the other contributor from some place in the world. In case you are reading this on thoughts of contributing to Pharo, please do not even give a second thought. You will fall in love with Pharo. Trust me. You will be in love with Pharo once you understand what it is and what the community are doing.


I am actually not even a little bit hesitant or ashamed of thanking my mentor and my org again and again ;). Guille, Thanks for supporting and guiding me over the last three months. The concepts you taught at times, criticism you gave, code reviews you gave and help you did are the best parts of my GSoC project. Thank you so much. You have been more like a friend to me rather than a mentor. I learnt a lot of things from you. You will be my inspiration. Besides, I would also like to thank my other mentor Philippe, org admins Serge, Jigyasa, Yuriy, Ben and other contributors especially Stephane Ducasee who in the first place suggested me to take this project when I made initial contact. Thank you all for helping me, guiding me and creating a great working environment. And Good luck to you Clement. It was nice working with you. Thank you all. You guys have made my last few months memorable.

Adios to you all. Till next time ;).



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s