Planet Squeak

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

April 18, 2019

PharoWeekly

[Pre-ann] Spec 2.0 Gtk3 bindings

People that assisted to Pharo Days 2019 (or that follow my twitter account) already know this, but it needs to be formally announced: 
 
We are working on Spec 2.0, and it will provide not just the classic Morphic bindings but also a new option for developers: Gtk3 bindings!
Why we want a Spec 2.0 with different backends?
There are reasons that converged to decide us to make it:
For us, this is a fundamental step to continue improving Pharo itself, and it matches also the work we are doing on going real-headless:  Pharo users will be able to start the Morphic world, a Gtk application or the next backend to come.
Why Gtk3?
There are some other important players in the “native widgets scene”, so why we choose Gtk3? 
Again, several reasons  were taken into account: 
Next step: tool migration
The only way to know if you have covered what is needed is actually taking real-life use cases and implementing them. We have a list of tools that needs to be migrated and we are starting from them: 
  1. Old GT tools will be replaced by new Spec tools (while preserving its power).
  2. Calypso UI needs to be rewritten in Spec 2.0 (it is in plain Morphic now).
  3. Pharo launcher as a standalone application is a good example of what you can do with the Gtk3 bindings.
And that’s it. Pharo 8.0 will come with Spec 2.0 and users will be able to benefit of it immediately 🙂
Pharo 80 will not need Gtk3. We will provide packages for Gtk3 for the people that need it. We will also release Spec20 soon so that people can try Spec 20 – independently of Gtk3
Pharo Consortium mainly Esteban, Pablo and Guille

by Stéphane Ducasse at April 18, 2019 06:06 PM

[ann] Workflow engine in Pharo

Hello everyone,
we’ve been working on a workflow engine written in Pharo. You can check it out at: https://github.com/skaplar/NewWave
It is still in the early development and we discussed about making it public so everyone interested can join, take a look or provide any kind of feedback. I’m also at discord so you can contact me @skaplar.
Best regards,
Sebastijan Kaplar

by Stéphane Ducasse at April 18, 2019 06:00 PM

Torsten Bergmann

Pharo and native UIs - from Mars to Spec

Pharo 7 (beside many other features) was focused on being able to bootstrap an image right from the source as well as the transition to using git. Also stabilizing Iceberg tool with Git binding to have an improved source code management and give Pharo and its source code more exposure to the outside non-Smalltalk world.


Now Pharo 8 (which is currently in development) will focus on an updated version of Spec called "Spec 2.0". To build abstractions and prove that other backends (beside Morphic) could be used there is a plan to have a GTK binding as a second backend. This goes back to the old "Mars" project from Esteban - a native user interface framework which aimed to bring the native UI into Pharo. If I remember correctly back at the time it used an ObjectiveC Bridge.

This was already discussed on PharoDays 2019 and now Esteban gives some more detailed infos about the background on the Pharo mailinglist.

by Torsten (noreply@blogger.com) at April 18, 2019 01:11 PM

April 17, 2019

Torsten Bergmann

Workflow engine written in Pharo

In 2017 Netstyle open sourced a workflow engine for Pharo. I reported about this here.

Now in 2019 there is another Workflow engine written in Pharo from Sebastijan Kaplar:

    https://github.com/skaplar/NewWave


Still in early development. But you can also join if you like

by Torsten (noreply@blogger.com) at April 17, 2019 06:27 PM

Data Analysis of UCI Heart Disease Dataset using Pharo

Data Analysis of UCI Heart Disease Dataset using Pharo - a short tutorial by Dhanya Sreekumar

by Torsten (noreply@blogger.com) at April 17, 2019 10:01 AM

April 16, 2019

Torsten Bergmann

Why I Talk About Smalltalk Even Though I’m Working in Java

Interesting medium.com article from Andrew Glynn called "Why I Talk About Smalltalk Even Though I’m Working in Java"

by Torsten (noreply@blogger.com) at April 16, 2019 09:21 PM

April 11, 2019

Torsten Bergmann

Hunter: a JavaScript reengineering platform based on Pharo

Hunter: a JavaScript reengineering platform based on Pharo is available on 

          https://github.com/dorellang/hunter


 

by Torsten (noreply@blogger.com) at April 11, 2019 03:40 PM

April 10, 2019

Torsten Bergmann

Pharo language track on exercism.io

An exercism.io language track for Pharo can be found here:  https://exercism.io/my/tracks/pharo-smalltalk

by Torsten (noreply@blogger.com) at April 10, 2019 12:45 PM

Pharo DataFrame v2.0

Pharo DataFrame release v2.0 is available: 

 https://github.com/PolyMathOrg/DataFrame/releases/tag/v2.0

Read here what it can do for you.

by Torsten (noreply@blogger.com) at April 10, 2019 12:22 PM

Pharo graphics using Roassal

Milton shows some nice graphics examples on his twitter stream (using Pharo and Roassal): 

https://twitter.com/akevalion

by Torsten (noreply@blogger.com) at April 10, 2019 12:20 PM

Pharo Newsletter April 2019

Pharo Newsletters for each month are available at:  http://newsletter.pharo.org

by Torsten (noreply@blogger.com) at April 10, 2019 12:18 PM

PharoDays 2019 in Lille

Some impressions from Pharo Days 2019 in Lille

https://gopro.com/v/rD5G5reVmG9pd

by Torsten (noreply@blogger.com) at April 10, 2019 11:23 AM

Debugger driven development in Pharo

Some work Vincent Blondeau and Stephan Eggermont have been doing on the Taskbar have inspired Stephan me to make some screencasts showing how to do debugger driven development, and take the first steps towards refactoring the TaskBarMorph in Pharo, driven by tests.

by Torsten (noreply@blogger.com) at April 10, 2019 09:31 AM

April 05, 2019

PharoWeekly

New success story: the openPonk platform

http://pharo.org/success/openPonk

Great work guys!

by Stéphane Ducasse at April 05, 2019 10:15 AM

Looking in the future @Pharodays

Really great talks at PharoDays

by Stéphane Ducasse at April 05, 2019 10:13 AM

April 02, 2019

PharoWeekly

About Performance Issues

Hi, this will be a long mail. I have organized it in different sections.

This work is sponsored by the Pharo consortium and financially supported by Lifeware and Schmidt.
Summary:
======

– There are performance issues in Pharo 7.
– I have made benchmarks.
– With Guille we made an improvement in saving source code in methods.
– More improvements to come.
– Automation and CI in the future.

Background
=========

Since the release of Pharo 7 (and before it), it was notorious that
there exists a performance regression in the normal execution of the
image. By checking the usual operations, we have seen ( and many have
also detected) that there was an issue with the loading, compilation,
and unloading of code. Also with the creation of classes, traits and
the use of slots.

Benchmarks
=========

Although we were sure that there is a performance regression, we have
to show it in a way we can test it and measure it. If we cannot
measure it or repeat its execution it is worthless.
For doing so, I have created an initial set of micro-benchmarks to
cover normal operations of the image.

The set of benchmarks is available here:
https://github.com/tesonep/pharo-benchmarks

These benchmarks are developed on top of SMark, only adding a command
line tool and the ability to generate a CSV file.

The idea is to run the benchmarks in different versions of Pharo an
assert that we are not breaking anything.

The first results were basically a nightmare, some operations take
almost 20 times more in Pharo 7. Especially, the ones that are
compiling methods.

In the attached document, there is the detail of all the benchmarks,
the different results and the analysis of the improvements and
regressions (Positive percentages are regressions (more time),
negative are improvements (less time)).

I have checked the results in OSX with 64 bits images. But as the
problem is in pure Smalltalk implementations the problems are (and the
solutions) cross platforms.

First Improvement
==============

Having the benchmarks, it was easy to start looking for the problems.
Thanks to the help of Guille we have detected some problems in the
implementation of SourceFile. Objects of this class have the
responsibility to handle the save of the source code when a method is
modified.

Improving this implementation we have gotten to results similar to
Pharo 6 in the compilation of methods.

Comparing a stock Pharo8 image with the one with the fix, we have the
following improvements:

AddingAnInstanceVariableToAClassWithASubclass -3.96%
AddingAnInstanceVariableToAClassWithoutASubclassAndInstances -15.91%
AddingAnInstanceVariableToAClassWithoutSubclasses -28.50%
ClassAndSubclassCreation -25.67%
ClassUsingATrait -90.05%
SimpleClassCreation -26.55%
TraitCreation -92.95%
TraitCreationUsingOtherTrait -91.68%
CompileAMethodAndModifyIt -32.92%
CompileAMethodInAClassUsingATrait -83.28%
CompileAMethodInATraitNotUsed -85.12%
CompileAMethodInATraitUsed -88.16%
CompileANewMethod -40.73%
CompileANewMethodUsingInstanceVariable -33.93%
MethodAccessingAGlobal -47.57%

Again there are more details in the attached file.

Also, we have ported this fix to Pharo 7.

Next Steps
========

– Making it a part of the CI infrastructure: making it run in each PR
and build to detect regressions in the changes.

– Adding more micro and macro benchmarks. I have a list of things to
test, but I am open to more:

# Micro

– Slot Implementation
– Process handling
– Refactorings
– Files (open / write / read)

# Macro

– Loading:  Moose  / Seaside
– Recompile All
– Condense Sources
– Startup
– Shutdown

We also know that there are platform related issues (especially
Windows), so the idea it will be the same, build a benchmark, measure
it, improve it.

The idea is to have a more robust way of detecting and handling the
performance of Pharo. Of course, I am open to all your comments.

Cheers,
Pablo

by Stéphane Ducasse at April 02, 2019 02:39 PM

March 29, 2019

Torsten Bergmann

ComputedSlots in Pharo

In Pharo 8 it is now possible to use ComputedSlots. Beside the regular instance variable (slots) we add a computed slot with a block.

Let's assume I would like to implement a Person class with a name and firstName but also get a fullName.

Object subclass: #Person
slots: { #name. #firstName. #fullName => ComputedSlot with: [ :obj | obj firstName asString , ' ' , obj name asString ] }
classVariables: { }
package: 'Simple-Example'

so when you test
 
|p|
p := Person new.
p name: 'Adams'.
p firstName: 'Douglas'.
p fullName

it would return the full name 'Douglas Adams'.

When you now add an additional class side method #firstName:name: like

firstName: firstName lastName: lastName

^(self new)
firstName: firstName;
name: lastName;
yourself

you can simply write with our small english like DSL:

 (Person firstName: 'Douglas' lastName: 'Adams') fullName

to get the same result.

For sure we could have implement the getter method #fullName like this:

fullName

^self firstName asString , ' ' , self name asString

to achieve the same - but a computed slot shows up really in the inspector as if it would be a real variable and is recomputed if you for instance would change the name or firstName.

by Torsten (noreply@blogger.com) at March 29, 2019 12:21 PM

March 28, 2019

PharoWeekly

[Ann] NeoDNS

About Paleo-DNS….
This did already exist in various forms, a couple of years ago I made a newer version, they can all be found in http://www.smalltalkhub.com/#!/~BenComan/DNS/ – including unit tests (but some of the older code in there is a bit stale).

It covers most record types, but most of them are not used a lot.

Simple usage:

NeoSimplifiedDNSClient default addressForName: ‘pharo.org‘. “104.28.27.35”

One of my goals was to use it as a more reliable, non-blocking ‘do we have internet access’ test:

NeoNetworkState default hasInternetConnection. “true”

From the class comments:

=======================
I am NeoSimplifiedDNSClient.

I resolve fully qualified hostnames into low level IP addresses.

NeoSimplifiedDNSClient default addressForName: ‘stfx.eu‘.

I use the UDP DNS protocol.
I handle localhost and dot-decimal notation.

I can be used to resolve Multicast DNS addresses too.

NeoSimplifiedDNSClient new useMulticastDNS; addressForName: ‘zappy.local’.

Implementation

I execute requests sequentially and do not cache results.
This means that only one request can be active at any single moment.
It is technically not really necessary to use my default instance as I do not hold state.
====================================
I am NeoDNSClient.
I am a NeoSimplifiedDNSClient.

NeoDNSClient default addressForName: ‘stfx.eu‘.

I add caching respecting ttl to DNS requests.
I allow for multiple outstanding requests to be handled concurrently.

Implementation

UDP requests are asynchroneous and unreliable by definition. Since DNS requests can take some time, it should be possible to have multiple in flight at the same time, thus concurrently. Replies will arrive out of order and need to be matched to their outstanding request by id.

If a request has been seen before and its response is not expired, it will be answered from the cache.

Each incoming request is handled by creating a NeoDNSRequest object and adding that to the request queue. This triggers the start up of the backend process, if necessary. The client then waits on the semaphore inside the request object, limited by the timeout.

The backend process loops while there are still outstanding requests that have not expired. It sends all unsent requests at once, and then listens briefly for incoming replies. It cleans up expired requests. When a reply comes in, it is connected to its request by id. The semaphore in the request object is then signalled so that the waiting client can continue and the request is removed from the queue. The process then loops. If the queue is empty, the backend process stops.

Sven

by Stéphane Ducasse at March 28, 2019 03:02 PM

[Ann] Paleo-DNS

Norbert and me looked at using DNS for service discovery and ran into some of the limitations of the NetNameResolver[1]. In the end I created an initial DNS implementation in Pharo called Paleo-DNS[2] to overcome these.

DNS is a protocol we use every day but rarely think of. There is an active IETF community that is evolving the protocol and finding new usages (service discovery is one of them).

In DNS there are different types of resource records (RR). The most commonly used ones in a client (“stub”) are “A” for IPv4 addresses, “AAAA” for IPv6 addresses, “CNAME” for aliases, “SRV” records. So far only support for “A” records was implemented.

So if you are curious about DNS then this is a great opportunity to add your favorite RR implementation to it and send a PR. There are probably 20+ of them to go. 😉

Query example using DNS-over-TLS (DoT) to Google Public DNS

PaleoDNSTLSTransport new
destAddress: #[8 8 4 4] port: 853;
timeout: 2 seconds;
query: (PaleoDNSQuery new
transactionId: (SharedRandom globalGenerator nextInt: 65535);
addQuestion: (PaleoRRA new rr_name: ‘pharo.org.’);
addAdditional: (PaleoRROpt new udpPayloadSize: 4096))

[1] It’s blocking on Unix, on Mac only one look-up may occur at a time and it returns exactly one address. There is also no IPv6 support.

[2] https://github.com/zecke/paleo-dns

by Stéphane Ducasse at March 28, 2019 03:01 PM

[Ann] Pharo Launcher 1.8.1

Hi all,

Pharo Launcher 1.8.1 has just been released! It is available from http://pharo.org/download.
Here is the changelog:

Bug fixes:

  • #326 Edit image description doesn’t update when editing existing description
  • #325 Instance of MacProcess did not understand #waitForCommand:
  • #324 sources file not found for Pharo < 3.0
  • #321 abort process if not responding. Uses TaskIt
Improvements:
  • #239 Mac OS menus display “SqueakOSXApp” instead of « PharoLauncher »
  • #323 Check if pharo-version.st should be updated
  • #322 do not try to run image without preferences if not supported by the image
Thanks to all contributors, including issue reports.
Regards,
The Pharo team.

by Stéphane Ducasse at March 28, 2019 02:56 PM

March 25, 2019

Craig Latta

The Big Shake-Out

Golden Retriever shaking off water

Some of those methods were there for a very long time!

I have adapted the minimization technique from the Naiad module system to Caffeine, my integration of OpenSmalltalk with the Web and Node platforms. Now, from a client Squeak, Pharo, or Cuis system in a web browser, I can make an EditHistory connection to a history server Smalltalk system, remove via garbage collection every method not run since the client was started, and imprint needed methods from the server as the client continues to run.

This is a garbage collection technique that I had previously called “Dissolve”, but I think the details are easier to explain with a different metaphor: “shaking” loose and removing everything which isn’t attached to the system through usage. This is a form of dynamic dead code elimination. The technique has two phases: “fusing” methods that must not be removed, and “shaking” loose all the others, removing them. This has a cascading effect, as the literals of removed methods without additional references are also removed, and further objects without references are removed as well.

After unfused methods and their associated objects are removed, the subsystems that provided them are effectively unloaded. For the system to use that functionality again, the methods must be reloaded. This is possible using the Naiad module system. By connecting a client system to a history server before shaking, the client can reload missing methods from the server as they are needed. For example, if the Morphic UI subsystem is shaken away, and the user then attempts to use the UI, the parts of Morphic needed by the user’s interactions are reloaded as needed.

This technology is useful for delineating subsystems that were created without regard to modularity, and creating deployable modules for them. It’s also useful for creating minimal systems suited to a specific purpose. You can fuse all the methods run by the unit tests for an app, and shake away all the others, while retaining the ability to debug and extend the system.

how it works

Whether a method is fused or not is part of the state of the virtual machine running the system, and is reset when the virtual machine starts. On system resumption, no method is fused. Each method can be told to fuse itself manually, through a primitive interface. Otherwise, methods are fused by the virtual machine as they are run. A class called Shaker knows which methods in a typical system are essential for operation. A Shaker instance can ensure those methods are fused, then shake the system.

Shaking itself invokes a variant of the normal OpenSmalltalk garbage collector. It replaces each unfused method with a special method which, when run, knows how to install the original method from a connected history server. In effect, all unfused methods are replaced by a single method.

Reinstallation of a method uses Naiad behavior history metadata, obtained by remote messaging with a history server, to reconstruct the method and put it in the proper method dictionary. The process creates any necessary prerequisites, such as classes and shared pools. No compiler is needed, because methods are constructed from previously-generated instructions; source code is merely an optional annotation.

the benefits of livecoding all the way down

I developed the virtual machine support for this feature with Bert Freudenberg‘s SqueakJS virtual machine, making heavy use of the JavaScript debugger in a web browser. I was struck by how much faster this sort of work is with a completely livecoded environment, rather than the C-based environment in which we usually develop the virtual machine. It’s similar to the power of Squeak’s virtual machine simulator. The tools, living in JavaScript, aren’t as powerful as Smalltalk-based ones, but they operate on the final Squeak virtual machine, rather than a simulation that runs much more slowly. Rebuilding the virtual machine amounts to reloading the web page in which it runs, and takes a few seconds, rather than the ordeal of a C-based build.

Much of the work here involved trial and error. How does Shaker know which methods are essential for system operation? I found out directly, by seeing where the system broke after being shaken. One can deduce some of the answer; for example, it’s obvious that the methods used by method contexts of current processes should be fused. Most of the essential methods yet to run, however, are not obvious. It was only because I had an interactive virtual machine development environment that it was feasible to restart the system and modify the virtual machine as many times as I needed (many, many times!), in a reasonable timeframe. Being able to tweak the virtual machine in real time from Smalltalk was also indispensable for debugging and feature development.

I want to thank Bert again for his work on SqueakJS. Also, many thanks to Dan Ingalls and the rest of the Lively team for creating the environment in which SqueakJS was originally built.

release schedule

I’m preparing Shaker for the next seasonal release of Caffeine, on the first 2019 solstice, 21 June 2019. I’ll make the virtual machine changes available for all OpenSmalltalk host platforms, in addition to the Web and Node platforms that Caffeine uses via the SqueakJS virtual machine. There may be alpha and beta releases before then.

If this technology sounds interesting to you, please let me know. I’m interested in use cases for testing. Thanks!

by Craig Latta at March 25, 2019 10:04 PM

PharoWeekly

Esteban’s blog post

http://log.smallworks.eu/web/search?from=18/3/2019&to=24/3/2019

by Stéphane Ducasse at March 25, 2019 07:12 AM

March 24, 2019

PharoWeekly

[Ann] Managing your Code with Iceberg

Hi

A first version of the first part of the book “managing your book with iceberg” is available at http://books.pharo.org.

 

S.&G.

by Stéphane Ducasse at March 24, 2019 08:07 PM

[Ann] Pharo with Style at books.pharo.org

Hi

I happy to announce that Pharo with Style is now available from http://books.pharo.org.

If you want to sponsor this book, let me know 🙂

Stef

by Stéphane Ducasse at March 24, 2019 08:05 PM

[Ann] How to get started with Iceberg

Hello

 

I’m happy to announce a new booklet (soon to be released) on how to manage code with Iceberg. We plan to discuss management patterns in the future.

https://github.com/SquareBracketAssociates/Booklet-ManagingCode

Stef and Guille

by Stéphane Ducasse at March 24, 2019 09:18 AM

March 22, 2019

PharoWeekly

New post on scripting github from Pharo :)

https://fuhrmanator.github.io/Using-GitHub-API-in-Pharo/

by Stéphane Ducasse at March 22, 2019 03:28 PM

March 17, 2019

PharoWeekly

[ANN] Lan.d.s Alpha: All Along the Language Tower

Dear friends !

I am quite excited to announce the availability of an alpha version
of my latest work around Parsing and Programming Languages at:

https://npapoylias.gitlab.io/lands-project/

Accompanied by ~ 30 min of transcribed eye-candy:

https://www.youtube.com/playlist?list=PLIjPQnRzAKVHABG1-oTvwWc3Gj1Z4C91B

Backed by a crowdfunding campaign ! To get the book and stable release
successfully out of the door:

https://www.patreon.com/lands_project
https://npapoylias.gitlab.io/lands-project/Support/

Click, download, watch, enjoy ! If you like what you see, support the project ! Tiers
start from 5 and 10 euros per chapter for individuals. Companies supporting
the project can get 6 to 12 days of consultancy, on-site workshops and other perks.

=================

What is all about ??

Lan.d.s is a new solution for language design. From general purpose
languages
like Lise (short for (list (embedding)) to Domain-Specific
Languages using the MOODs framework
, and everything else in between.
Lan.d.s is build around the formalism of Multi-Ordered Grammars,
which are a possible alternative to CFGs and PEGs in wider use today.

Multi-ordered grammars (or simply MOGs) aim for a better exploration of ambiguity,
recursion, ordering and associativity during language design. They can be parsed using the
Gray Algorithm.
After parsing in order to ease the production of executable code
Lan.d.s introduces the Abstract Syntax Language (ASL), which is an OO
solution for compile-time meta-programming. Finally in order to promote
language extension and re-use, Lan.d.s employs GrammarTraits, as units of
composition for both MOG rules and ASL actions.

=================

Some random highlights for the impatient:

* Object subclass: #Prediction uses: Future syntax

* Languages are everywhere, they are all around you, even now in this very sentence.

* Study SICP with a Xerox flavor, while re-inventing some Bell-labs utilities.

* TOC-Board, the TOC for your next talk 😉

Enjoy !

Lands-Alpha-All-Along-The-Language-Tower.png

by Stéphane Ducasse at March 17, 2019 01:20 PM

March 16, 2019

PharoWeekly

About Pharo and LibC

https://fuhrmanator.github.io/LibC-Pharo-experiments/

by Stéphane Ducasse at March 16, 2019 04:55 PM

March 13, 2019

PharoWeekly

[ANN] Minimal telepharo

I’m working on having a telepharo image based on the pharo minimal image. With the help of pavel and Allex I prepared a usable artefact on github that can be used. Both images are based on Pharo8.

The release file
https://github.com/noha/pharo-minimal/releases/download/0.1/telepharo.zip
contains a 32 bit minimal telepharo server image. It is 12,1 MB in size. And there is a 64 bit full pharo telepharo client image in the archive that can be used to connect to the minimal server one. I did not include the vms in the archive. These you need to install separately.
To run the server do
$ ./pharo server.image eval –no-quit “TlpRemoteUIManager registerOnPort: 40423“
The client.image can be started as usual. In a playground do


To be connected to the minimal server image. Further details on telepharo you can find at
https://github.com/pharo-ide/TelePharo
Further relases of this will be made available at
https://github.com/noha/pharo-minimal/releases
I’m planning to make a pharothings release available as well when the telepharo release is considered stable.
Hope you like it,
Norbert

by Stéphane Ducasse at March 13, 2019 07:50 PM

March 05, 2019

PharoWeekly

[Ann] v7.0.2

Hello Happy Pharoers

We just issued a release for pharo 7.0

Bugfix release

The crew

by Stéphane Ducasse at March 05, 2019 06:14 PM