Planet Squeak

blogs about Squeak, Pharo, Croquet and family
planet squeak - planet squeak es - planet squeak jp - planet croquet - planet squeak code - planet smalltalk

October 01, 2014

Torsten Bergmann

ESUG 2014 Photos

Photos from European Smalltalk User Group (ESUG) 2014 conference can be found here.

by Torsten ( at October 01, 2014 06:14 AM

Smalltalk news on all sides

While I often blog about news in the open source Smalltalk scene one additionally has to note that the commercial Smalltalk vendors are also playing well. Interesting news from Instantiations about upcoming VASmalltalk and similar news from Cincom about CincomSmalltalk appear regulary on the web. Nice!

by Torsten ( at October 01, 2014 06:12 AM

Gilad Bracha

A DOMain of Shadows

One of the advantages of an internal DSL  over an external one is that you can leverage the full power of a general purpose programming language. If you create an external DSL, you may need to reinvent a slew of mechanisms that a good general purpose language would have provided you: things like modularity, inheritance, control flow and procedural abstraction.

In practice, it is unlikely that the designer of the DSL has the resources or the expertise to reinvent and reimplement all these, so the DSL is likely to be somewhat lobotomized. It may lack the facilities above entirely, or it may have very restricted versions of some of them. These restricted versions are mere shadows of the real thing; you could say that the DSL designer has created a shadow world.
I discussed this phenomenon as part of a talk I gave at Onward in 2013. This post focuses on a small part of that talk.

Here are three examples that might not always be thought of as DSLs at all, but definitely introduce a shadow world.

Shadow World 1: The module system of Standard ML.

ML modules contain type definitions. To avoid the undecidable horrors of a type of types, ML is stratified.  There is the strata of values, which is essentially a sugared lambda calculus. Then there is the stratum of modules and types. Modules are called structures, and are just records of  values and types. They are really shadow records, because at this level, by design, you can no longer perform general purpose computation. Of course, being a statically typed language, one wants to describe the types of structures. ML defines signatures for this purpose. These are shadow record types. You cannot use them to describe the types of ordinary variables.

It turns out one still wants to abstract over structures, much as one would over ordinary values. This is necessary when one wants to define parameterized modules.  However, you can’t do that with ordinary functions. ML addresses this by introducing functors, which are shadow functions. Functors can take and return structures, typed as signatures. However, functors cannot take or return functors, nor can they be recursive, directly or indirectly (otherwise we’d back to the potentially non-terminating compiler the designers of ML were trying so hard to avoid in the first place).

This means that modules can never be mutually recursive, which is unfortunate since this turns out to be a primary requirement for modularity. It isn’t a coincidence that we use circuits for electrical systems and communication systems, to name two prominent examples.  

It also means that we can’t use the power of higher order functions to structure our modules. Given that the whole language is predicated on higher order functions as the main structuring device, this is oddly ironic.

There is a lot of published research on overcoming these limitations. There are papers about supporting restricted forms of mutual recursion among ML modules.  There are papers about allowing higher-order functors. There are papers about combining them. These papers are extremely ingenious and the people who wrote them are absolutely brilliant. But these papers are also mind-bogglingly complex.  

I believe it would be much better to simply treat modules as ordinary values. Then, either forego types as module elements entirely (as in Newspeak)  or live with the potential of an infinite loop in the compiler. As a practical matter, you can set a time or depth limit in the compiler rather than insist on decidability.  I see this as a pretty clear cut case for first class values rather than shadow worlds.

Shadow World 2: Polymer

Polymer is an emerging web standard that aims to bring a modicum of solace to those poor mistreated souls known as web programmers. In particular, it aims to allow them to use component based UIs in a standardized way.

In the Polymer world, one can follow a clean MVC style separation for views from controllers. The views are defined in HTML, while the controllers are defined in an actual programming language - typically Javascript, but one can also use Dart and there will no doubt be others. All this represents a big step forward for HTML, but it remains deeply unsatisfactory from a programming language viewpoint.

The thing is, you can’t really write arbitrary views in HTML. For example, maybe your view has to decide whether to show a UI element based on program logic or state. Hence you need a conditional construct. You may have heard of these: things like if statements or the ?: operator. So we have to add shadow conditionals.

<template if="{{usingForm}}">

is how you’d express  

if (usingForm) someComponent;

In a world where programmers cry havoc over having to type a semicolon, it’s interesting how people accept this. However, it isn’t the verbose, noisy syntax that is the main issue.

The conditional construct doesn’t come with an else of elsif clause, nor is their a switch or case. So if you have a series of alternatives such as

if (cond1) {ui1}
else if (cond2) {ui2}
        else {ui3}

You have to write

<template if = "{{cond1}}">
<template if = "{{cond2 && !cond1}}">
<template if = "{{cond3 && !cond2 && !cond3}"}>


A UI might have to display a varying number of elements, depending on the size of a data structure in the underlying program. Maybe it needs to repeat the display of a row in a database N times, depending on the amount of data. We use loops for this in real programming. So we now need shadow loops.

<template repeat = "{{task in current}}">

There’s also a for loop

<template repeat= "{{ foo, i in foos }}">

Of course one needs to access the underlying data from the controller or model, and so we need a way to reference variables. So we have shadow variables like


and shadow property access.


Given that we are building components, we need to use components built by others, and the conventional solution to this is imports. And so we add shadow imports.

<link rel = "import” href = "...">

UI components are a classic use case for inheritance, and polymer components support  can be derived from each other, starting with the predefined elements of the DOM, via shadow inheritance.  It is only a matter of time before someone realizes they would like to reuse properties from other components in different hierarchies via shadow mixins.

By now we’ve defined a whole shadow language, represented as a series of ad hoc constructions embedded in string-valued attributes of HTML.  A key strength of HTML is supposed to be ease-of-use for non-programmers (this is often described by the meaningless phrase declarative). Once you have added all this machinery, you’ve lost that alleged ease of use - but you don’t have a real programming language either. 

Shadow World 3: Imports

Imports themselves are a kind of shadow language even in a real programming language. Of course imports have other flaws, as I’ve discussed  here and here, but that is not my focus today. Whenever you have imports, you find demands for conditional imports, for an aliasing mechanism (import-as) for a form of iteration (wildcards).  All these mechanisms already exist in the underlying language and yet they are typically unavailable because imports are second-class constructs.

Beyond Criticism

It is very easy to criticize other people’s work. To quote Mark Twain:

I believe that the trade of critic, in literature, music, and the drama, is the most degraded of all trades, and that it has no real value 

So I had better offer some constructive alternative to these shadow languages. With respect to modularity, Newspeak is my answer. With respect to UI, something along the lines of the Hopscotch UI framework is how I’d like to tackle the problem. In that area, we still have significant work to do on data binding, which is one of the greatest strengths of polymer. In any case, I plan to devote a separate post to show how one can build an internal DSL for UI inside a clean programming language. 

The point of this post is to highlight the inherent cost of going the shadow route. Shadow worlds come in to being in various ways. One way is when we introduce second class constructs because we are reluctant to face up to the price of making something a real value. This is the case in the module and import scenarios above. Another way is when one defines an external DSL (as in the HTML/Polymer example). In all these cases, one will always find that the shadows are lacking. 

Let’s try and do better.

by Gilad Bracha ( at October 01, 2014 05:19 AM

September 30, 2014

Torsten Bergmann

Visualize network latency using Pharo

Visualize network latency using Pharo. Read more here.


More infos here.

by Torsten ( at September 30, 2014 09:04 AM


2nd IEEE Working Conference on Software Visualization is currently held in Victoria, CA. From the twitter posts it looks like the Pharo based agile visualization tools are interesting for the participants.

by Torsten ( at September 30, 2014 08:50 AM

September 24, 2014

Torsten Bergmann

Smalltalk block translator

Use blocks for parsing. Read more.

by Torsten ( at September 24, 2014 06:04 PM

Quicksilver - a Framework for Hierarchical Data Analysis in Pharo

Read the paper.

by Torsten ( at September 24, 2014 06:03 PM

September 21, 2014

Torsten Bergmann

Calling Blender

Calling Blender using Pharo with Ephestos 0.1

by Torsten ( at September 21, 2014 06:48 PM

PocketCube solved by DijEvolution

Dijkstra shortest path search algorithm can find solution for PocketCube using Pharo. See the video here.

by Torsten ( at September 21, 2014 06:39 PM

September 19, 2014

Torsten Bergmann

Bootstrap (V0.12.2) for Seaside

An updates version of Bootstrap (V0.12.2) for Seaside is available. You can easily load it from the Configuration Browser in Pharo 3.0 or the project site.

Beside more tests it features vertical tabs which is a simple wrapper of a component found on the web. 

Look at the online demo for Bootstrap to see how easy one can use them:

by Torsten ( at September 19, 2014 08:10 AM

DataTables jQuery plugin for Seaside

If you build a web application using Seaside and Pharo, maybe using my Bootstrap wrapper project you might be interested in a good data table plugin to display tabular data.

There is a nice (commercial) jQuery plugin called DataTables. Esteban made it available as a plugin for Seaside now and describes this here.

by Torsten ( at September 19, 2014 06:18 AM

September 17, 2014

Torsten Bergmann

Saucers 1.5

A nice little game built with Squeak using Morphic.

by Torsten ( at September 17, 2014 07:11 PM

Pharo Sprint Lille 26th september

see here.

by Torsten ( at September 17, 2014 02:09 PM

SciSmalltalk v0.14 is released.

Read more here and check the project here.

by Torsten ( at September 17, 2014 09:46 AM

September 16, 2014

Torsten Bergmann

SortFunctions for Pharo

SortFunctions allow you to easily work with sorting in Smalltalk. Checkout the project at SmalltalkHub where you will also find the docu and examples.

by Torsten ( at September 16, 2014 07:48 PM

Test Coverage with Hapao

Hapao2 for Pharo is arrived. Read more details here.

by Torsten ( at September 16, 2014 06:03 PM

Performance enhancement of list updating operation

see here.

by Torsten ( at September 16, 2014 06:00 PM

September 11, 2014

Squeakland News

How to do timing in Etoys?

I just got this question from my students and I thought there might be others with similar interests. So how can I control sequences of actions over time? Say, I want to use speech bubbles to tell a story. I have a number of sentences to show, one after another, and I want to let some time pass between them to give the reader time to read. How can I do that?

Well, I can build a timer and check the time to trigger actions when a certain time is reached. How can I build a timer?

First of all, you need a variable to count time steps. Open the viewer for your object. Create a variable by clicking the "v" - symbol in the top row of the viewer and give your variable a name. I choose "seconds". The default type is "Number", which is fine and 0 decimals places are perfect as well.

Now open a new empty script and drag the tiles to assign a new value to your variable into the script. Change the operation to "increase by" and the number to "1". Make sure the value of your variable is "0" at the start! Name the script "timer".

You do know already that the script, once started, will be executed repeatedly until it is being stopped, right? Do you also know how fast or how slowly this happens? You can see this when you click on the watch in the top row of the scriptor and hold the mouse button down. And you can also change it there! By default, it will be executed 8 times per second. Change this into once per second!

When you now start the script, each second it will increase the value of your variable "seconds" by 1! Now you can use the value of the variable in other scripts:

Use a all-scripts-tile from the supplies to start both, your script and the timer, at the same time and watch :)

Please note: It depends on your computer and what other programs are running on it at the same time, if a second in the Etoys project will be the same as a second at a real clock. It may not be exactly the same, but probably close. It is definitely good enough to control the flow of a story, but for scientific experiments, you should use a real timer!

There is another approach to time handling in this post from Ricardo Moran.

You can also find a tutorial to build a timer in project 6 of the book "Powerful Ideas in the classroom" by Kim Rose and B.J. Allen-Conn.

by Rita ( at September 11, 2014 11:48 AM

September 10, 2014

Torsten Bergmann

Seaside 3.1.3

is released. Read the announcement or browse the change log.

by Torsten ( at September 10, 2014 11:22 AM


A small tool to find references to an object visually. Code is on SmalltalkHub.

Also on PharoWeekly.

by Torsten ( at September 10, 2014 07:52 AM


OSMMaps is a Pharo package to interact with OpenStreetMap. Read more here.

by Torsten ( at September 10, 2014 06:51 AM

September 09, 2014

Torsten Bergmann

New Release of Essence Sharp: Nīsān-2 (Alpha Build 23)

A new Release of Essence Sharp: Nīsān-2 (Alpha Build 23) is available. Read more.

by Torsten ( at September 09, 2014 06:47 AM

Invitation to Smalltalks 2014

The Fundación Argentina de Smalltalk (FAST) invites you to the 8th International Conference on Smalltalk Technologies. Read more.

by Torsten ( at September 09, 2014 06:45 AM

Kontolino demo vide - a Seaside Smalltalk application from germany company Objektfabrik is now also demonstrated in a first video:

by Torsten ( at September 09, 2014 06:43 AM

September 05, 2014

Torsten Bergmann


A Scratch clone running on iPad, read more here.

by Torsten ( at September 05, 2014 07:35 AM

September 03, 2014

Torsten Bergmann

Pharo Seaside : Looking at HTTP Traffic

If you want to easily look at the HTTP traffic in your Pharo based Seaside application then just evaluate:

       ZnLogEvent open

This will open an spy on the Zinc announcements. Then start your server using:

     ZnZinServerAdaptor startOn: 8080.

and use the webbrowser to browse your Seaside application. You will now see any HTTP exchange between the client and the server.

The video demonstrates this:

by Torsten ( at September 03, 2014 07:30 AM

IDE4PLC based on Pharo

A free IDE for Programming PLC's (Programmable Logic Controller) based on Pharo Smalltalk written by Eric Nicolás Pernia from the Universidad Nacional de Quilmes.

Read more on the page site or browse the code on GitHub.

by Torsten ( at September 03, 2014 07:09 AM

How to run Pharo 3.0 on top of Linux 64 bits

Read more here.

by Torsten ( at September 03, 2014 06:19 AM

September 02, 2014

Torsten Bergmann — In 10 Cool Pharo Classes

Another nice article published by Sven on how to use Pharo, the Seaside web framework and the Glorp ORM together with Postgres DB to create a version.

Read more here.

by Torsten ( at September 02, 2014 08:18 AM

August 30, 2014

Gilad Bracha

Taking it to Th’emacs

Emacs is my preferred text editor. I don’t use old-fashioned text editors as much as I used to, because I often need more specialized tools.  I use IDEs for various programming languages and other things when producing high quality documents. And yet, I often wish I could subsume these with a tool that had the basic goodness of emacs.

What makes emacs interesting all these decades after its inception is not what keyboard shortcuts it supports or what its basic editing functionality is. Rather, what matters are some of its underlying design principles.
As a consequence, you can control everything emacs does programmatically. This makes emacs extensible in a way that is far deeper and more powerful than a plug-in architecture. A plug-in architecture must anticipate every desired extension to the system. Since it never can, it always disappoints in the end. Along the way it grows ever more complex and bloated in its futile attempt to foresee every possible need. With a language, you can code any extension you need.

If the scripting language is truly dynamic, and allows you to not only extend but also modify the running system, the possibilities are truly unlimited.

The points above are not limited to editors. They are fundamentals of system design.

There was a time when even Microsoft recognized this, making apps that could be programmed via VisualBasic. Sadly, they concocted a security nightmare, because malware can also control your application. Which is why being able to secure your application’s scripting language is critical as well. 

Last June, I spoke at QCon NY, and demonstrated a number of interesting web based systems that had some these properties (as well as a couple that did not, but were interesting for other reasons):
We really need an Emacs for the modern age.  An editor, surely, but one that lets you edit rich text, images, audio and video. In fact, you should be able to embed arbitrary widgets. And of course it needs to be scriptable I just explained. So you might evaluate code that creates a UI element and inserts into the editor.  

Now you can make the editor modify its own GUI. In fact, the editor can be extended into a general purpose GUI builder just like Lively. And every such GUI can modify itself if you wish; sometimes you may wish to modify it so it can no longer modify itself, and then you have a frozen application. Your editor has become an IDE. In fact, it is a live literate programming environment

If the editor’s scripting language interoperates well with the surrounding environment, it can be used to control the computer and everything the computer itself controls. You can check in to the environment and hardly ever leave. You can lead your cyber life in it.: email, social media, live chats, streaming audio and video can all be incorporated. Moreover they can all be controlled and customized by you, the lucky user. 

To a degree, Lively is such an editor. It’s biggest drawbacks are a lack of polish due to lack of engineering resources and that its scripting language is Javascript.

Now, imagine that the editor was polished and robust. Even more importantly the code you created in this environment was modular and secure and written in an elegant and principled language. Imagine you could deploy the same code either on the web, or natively on both desktop and mobile. Imagine that the applications built with the language support online and offline use out of the box, automatically synchronizing data and code between clients and servers. Imagine that they have built-in support for collaboration, either syncing in real time or merging offline as required. 

Of course, it is the vision of such a language and platform that has always motivated the Newspeak project.  I have discussed many of these points before. In particular, I’ve talked about the weaknesses of traditional IDEs (see for example this post and this one), and the need for a platform that supports synchronization over the net (here and again here) for a long time. Yet the message bears repeating. 

by Gilad Bracha ( at August 30, 2014 10:07 PM