Start
Prop Job
Cog in the Machine
Hubba-Hubba
Spin Control
It's a Cog's Life
Propeller Heads Wanted
Sources and PDF
SPIN
CONTROL
Topping
off the Propeller package is the aptly named
Spin language. Like the cog architecture itself,
Spin combines aspects of languages that have
gone before. You might think of it as an interpreted
semi-object-oriented superassembler.
I
say semi-object-oriented because it incorporates
some of the most useful features of that approach
(e.g., objects can be shared and have both publicly
accessible and private routines and data) while
eschewing the more esoteric aspects (polymorphism,
inheritance, etc.).
Having
programmed in dozens of languages over the years,
I’m generally well past the stage of nitpicking
syntactic trinkets. Does it really matter whether
an assignment statement uses a = or := symbol?
However, one aspect of Spin that’s sure to cause
some head scratching is the fact that white
space matters. For instance, the last statement
of a loop isn’t necessarily delineated by a
NEXT statement or a squiggly bracket, but rather
by a change in the level of indentation. As
with the vagaries of any language (English comes
to mind), it’s something you have to get used
to. But at first this will trip you up, especially
when cutting and pasting blocks of code.
These
days, the integrated development environment
(IDE) is as important as the language itself.
The Propeller IDE incorporates a number of novel
features that reflect some interesting philosophical
underpinnings. For example, there’s a clear
intention to support the collaborative development
of objects (i.e., subprograms) for use by the
entire community. To that end, programs are
intended to be self-documenting, so much so
that Parallax even defines a special font allowing
the incorporation of schematics and equations
as documentation in the code listing (see Photo
3, p. 81).
|

(Click
here to enlarge)
|
Photo
3—Key to the Propeller philosophy is that
the IDE encompasses all aspects of a design.
Thanks to a special font that includes graphic
symbols, program listings can even include
hardware schematics and timing diagrams. |
Similarly,
different view modes in the IDE allow you to
focus on the high level (i.e. documentation,
public declarations) or zoom in on the gory
details. There’s even an archive option that
packs all of a project’s programs and the IDE
itself in a ZIP file. That way, you can send
it off to another person without having to worry
whether they have the right version of the IDE,
libraries, etc.