This month, Swift has dropped to #19 almost looking like it's going to fall out of the top 20 altogether.
Strange times.
This month, Swift has dropped to #19 almost looking like it's going to fall out of the top 20 altogether.
Strange times.
The example is a set of commands for moving a robot:
-moveNorth.
-moveSouth.
-moveWest.
-moveEast.
"It’s awkward to work with this kind of interface because you can’t pass around, store or perform calculations on the direction at all."
move:
message
with a separate direction
argument. The current fashion would be to make direction
an enum, but he (wisely, IMHO) turns it into a class that can encode different directions:
-move:direction.
class Direction {
...
}
...we have this message obsessions at a massively larger scale with accessors.
-attribute.
-setAttribute:newValue.
-get:identifier.
-set:identifier to:value.
And it turns out that passing those identifiers around performing calculations on them is tremendously powerful, even if you don't have language support. Without language support, the interface between the world of reified identifiers and objects can be a bit awkward.