Monthly Archives: January 2016

Fuel faster and BMP reader :)

Fuel reading is 60% faster than BMP:
Smalltalk garbageCollect; garbageCollect.
r1 := [FileLocator imageDirectory / ‘test.bmp’ readStreamDo: [ :s |
s binary.
fromBMP := BMPReadWriter formFromStream: s]] benchFor: 2 seconds.
Smalltalk garbageCollect; garbageCollect.
r2:=[FileLocator imageDirectory / ‘test.fuel’ readStreamDo: [ :s |
s binary.
fromFuel := (FLMaterializer newDefault materializeFrom: s) root]] benchFor: 2 seconds.
{ r1. r2 } “an Array(a BenchmarkResult(2,199 iterations in 2 seconds 2 milliseconds. 1,098 per second) a BenchmarkResult(5,728 iterations in 2 seconds 3 milliseconds. 2,860 per second))”

Travis CI integration added to OSSubprocess and FFICHeaderExtractor

Hi guys,

This is just to let you know that with the help of Esteban and between some work together [1] [2] I was able to have Travis CI integrated with OSSubprocess and FFICHeaderExtractor [3] [4] . Both projects are built and tested under Linux and OSX. Note also that one of the projects does a lot of FFI calls to system libs like libc and the other even generates C programs, compiles them and run it. Even the OS dependencies (like installing the compiler) are resolved correctly 🙂
If someone wants to know how it’s done, simply check the .travis.yml and the scripts/ of each project [5] [6].

FFI C Header Extractor

Dear all,

I am happy to announce the first release of FFICHeaderExtractor project. You can find the project and the documentation here:

Any feedback is more than welcome.

FFICHeaderExtractor first milestone

Hi guys,

OK, I have a first working version and so I wanted to share it with you.
I have not yet the time to start writing the doc since I just finished the first pass on the code. Tomorrow I will start with the doc. But I thought some of you may be interested in taking a look even without formal “doc” (and some feedback/iteration may avoid re-writing docs..).
If you have no clue what I am talking about, then this summary is for you:
When we  use FFI  to call a certain library it’s quite common that we need to pass as argument certain constants (for example, SIGKILL to kill()). These constants are defined in C header files and can even change it’s value in different paltforms. 
These constants also are sometimes defined by the C preprocessor and so there is not way to get those values from FFI. If you don’t have the value of those constants, you cannot make the FFI call. 
I have tested the tool in OSX and CentOS using latest Pharo 5.0. It won’t work in Windows right now.  As usual, all classes and methods have comments and there are enough tests.
At the end, I decided the C program will output a very naive Smalltalk literal array kind of thingy. The tool then parses that output and directly creates a init method (which is compiled into the SharedPool class) for that platform which is then called automatically at startup (only if initialization is needed).
As for real examples, I started to write constants for libc:  signal.h (to use kill()) , wait.h (to use wait() famility), fcntl.h (to use … xxx()) , and errno.h. You can take a look to the package ‘FFICHeaderExtractor-LibC’.
Note that for running the tests you need ‘cc’ findable by path in OSX and ‘gcc’ in Unix.
To load the code in a latest Pharo 5.0, execute:
Metacello new
    baseline: ‘FFICHeaderExtractor’;
    repository: ‘github://marianopeck/FFICHeaderExtractor:master/repository’;
Any feedback is appreciated. 
I will start writing the doc now.
BTW: Big thanks to Eliot Miranda which helped me answering noob questions and providing useful code and guidelines. 

How to parse ndjson in Pharo with NeoJSON

Reading the ‘format’ is easy, just keep on doing #next for each JSON expression (whitespace is ignored).
| data reader |
data := ‘{“smalltalk”: “cool”}
{“pharo”: “cooler”}’.
reader := NeoJSONReader on: data readStream.
Array streamContents: [ :out |
  [ reader atEnd ] whileFalse: [ out nextPut: reader next ] ].

Preventing intermediary data structures is easy too, use streaming.
| client reader data networkStream |
(client := ZnClient new)
  streaming: true;
  url: ‘’;
networkStream := ZnCharacterReadStream on: client contents.
reader := NeoJSONReader on: networkStream.
data := Array streamContents: [ :out |
  [ reader atEnd ] whileFalse: [ out nextPut: reader next ] ].
client close.

It took a couple of seconds, it is 80MB+ over the network for 50K items after all.

New GitHub API bindings

Hi everyone,

I am announcing a new version for the API bindings to GitHub in Pharo.
For documentation and information on how to load it, see the new project homepage: (generated with Pillar. Plug for Damien and Cyril)
For a list of changes in this release, follow this link:
To load absolutely everything, including the tests and the tool, evaluate:
Metacello new
    baseline: ‘GitHub’;
    load: #(tests tool)
If you have loaded the tool, it can be opened via the world menu, under “Tools”.
Feedback welcome 🙂

Specific Domain Visualisations

As I told you before, I have been using Pharo/Moose/Roassal to approach certain problems by agile prototyping and visualization. It has been a really empowering community and technology and even a newbie can feel more eloquent talking to/with computers, so thanks as always.

Here is the blog post with more details:

And here the tweet if you’re in that network and want to reshare:

Hopefully I have been clear in the blog, but any advice to my almost self taught English, or proof reading or improvements are welcomed. I also hope putting proper credits to all the people involved in this visualization. And hopefully soon (at some point in February) I will be sharing some advances in the interactive notebook front also.



Bounty for Pharo


We have set up a Pharo  on the new Salt platform of bountysource:

This is an easy way to support pharo development. If you support 
above a certain threshold, being a Salt supporter includes a 
membership for the Pharo Association.


Another step for the bootstrap

Hi all,

In case you do not know, we work on bootstrapping Pharo, i.e. create a Pharo image from sources, not based on a previous image (well, we use a pharo image to produce it but no code / state from it).

This process will allow one to define a minimal Pharo kernel (currently 52 packages but we could have it far smaller) and to modularize the whole image (currently packages have too much dependencies on packages already loaded into the image).
The bootstrap process also allows one to write down the recipe to initialize a new image from scratch (some code is missing in the image or is wrong). In addition, I think we will clean a lot of historical objects that are not used anymore.

With the amazing work done by Guillermo Polito during his Phd (around Espell, Oz):, we succeeded to get a first prototype of a bootstraped Pharo 5 image (from 5.392).
This prototype is able to run an eval command line handler and to log output / errors. Not all classes are yet initialized and you cannot yet save / restart this image but it is a big step forward.
It is a 4 mb image (could be half the size without unicode data). You can download it at:

Next steps are to have a bootstrapped image fully working, then to load packages on top of it (like network, sunit) to produce a minimal image.
Then, we need to implement an Oz VM on top of Spur.
After that, we need to work on a reliable way to build the bootstrap (not too sensitive to changes in the image).


demarey@193-51-236-143:~/dev/rmod/bootstrap/bootstrap-2016-01-19$ ../pharo bootstrap.image –no-default-preferences eval “1 + 1”
demarey@193-51-236-143:~/dev/rmod/bootstrap/bootstrap-2016-01-19$ ../pharo bootstrap.image –no-default-preferences eval “‘a’ , ‘b'”
demarey@193-51-236-143:~/dev/rmod/bootstrap/bootstrap-2016-01-19$ ../pharo bootstrap.image –no-default-preferences eval “1 / 0”

EvaluateCommandLineHandler>>no (source is Undeclared)
no source in EvaluateCommandLineHandler>>evaluate: in Block: no source
EvaluateCommandLineHandler class(CommandLineHandler class)>>activateWith:

BasicCommandLineHandler>>no (source is Undeclared)
no source in PharoCommandLineHandler(BasicCommandLineHandler)>>activateSubCommand: in Block: no source

BasicCommandLineHandler>>no (source is Undeclared)
no source in PharoCommandLineHandler(BasicCommandLineHandler)>>activate in Block: no source
PharoCommandLineHandler class(CommandLineHandler class)>>activateWith:

PharoCommandLineHandler class>>no (source is Undeclared)
no source in PharoCommandLineHandler class>>activateWith: in Block: no source
PharoCommandLineHandler class>>activateWith:
no source in BasicCommandLineHandler>>activateSubCommand: in Block: no source
no source in BasicCommandLineHandler>>activate in Block: no source

SmallInteger>>no (source is Undeclared)

UndefinedObject>>no (source is Undeclared)

AbstractCompiler>>no (source is Undeclared)

SmalltalkImage>>no (source is Undeclared)

BlockClosure>>no (source is Undeclared)

EvaluateCommandLineHandler>>no (source is Undeclared)

EvaluateCommandLineHandler>>no (source is Undeclared)

CommandLineHandler class>>no (source is Undeclared)

BasicCommandLineHandler>>no (source is Undeclared)

BasicCommandLineHandler>>no (source is Undeclared)

PharoCommandLineHandler>>no (source is Undeclared)

UIManager>>no (source is Undeclared)

UndefinedObject>>no (source is Undeclared)

CommandLineUIManager>>no (source is Undeclared)

SmalltalkImage>>no (source is Undeclared)

DelayMicrosecondScheduler>>no (source is Undeclared)

BlockClosure>>no (source is Undeclared)

SmalltalkImage>>no (source is Undeclared)

WeakArray class>>no (source is Undeclared)
ps: source cannot be displayed because there is no formatter available in the bootstrap