Acerca de mi

Soy Javier Ferrer González.

Actualmente trabajo como desarrollador web backend en Uvinum, estoy finalizando el Grado en Ingeniería Informática en la FIB-UPC y doy clases en el Máster de Programación Web de Alto Rendimiento de LaSalle BCN.

En este blog encontrarás posts sobre internet, programación y reflexiones variadas.

Si quieres saber más acerca de mi, aquí tienes mi Currículum y el formulario de contacto.
Acerca de mi

Continuations in Smalltalk

Here you have one of the most interesting tasks I’ve had to do for my Computer Science degree. It’s about how Continuations works in Smalltalk, and all we have to do was to implement some very simple methods in order to modify the program execution flow.

I always knew that one day Smalltalk would replace Java. I just didn’t know it would be called Ruby. – Kent Beck

Here you have a graphic with an example in order to be able to make you an idea of what the program does in terms of execution state modification:

Smalltalk continuations

Smalltalk continuations

This is the GitHub repository with all the code and the report about how my college Pol Garcia and me worked together (using GitHub with a Smalltalk project in Pharo), the tests we developed, and the explanation of the learned concepts (in Spanish).

If you want to have an idea of the essence of the program and how it works, just take a look at this line of code, it comes from the #angelPloraner method:

"Put the current context into the angelsPloranersContextsStack in order to be able to recover it from a #doctor call."
angelsPloranersContextsStack push: ( Continuation fromContext: thisContext sender ).

As you can see, all we’re doing here is putting in a stack of Contexts the current one without taking into account the #angelPloraner method itself. This is the most important line of the program, because then, we can recover this context from the stack and evaluate other expressions in this saved context. In other words: We can execute something in a previous program state, here you have how:

"If we've any angel ploraner context stored on the angelsPloranersContextsStack, recover it and evaluate the expression on it."
lastAngelPloranerContext := angelsPloranersContextsStack pop.
lastAngelPloranerContext value: anExpression.

If you want more information about contexts in Smalltalk, you can check out the chapter 14 of the Deep into Pharo book.

By the way, I would like to make a special mention to our teacher in this subject: Jordi Delgado. Subjects like this (Advanced Programming Concepts), only possible thanks to people like him, are the ones which provides some sense to the idea of finalizing the degree and not drop it out despite the fact of having to combine it with a job.

Share this Story

Posts relacionados

Deja un comentario

Subscríbete por email

Recibe las noticias que se publiquen en tu buzón: