I can’t believe that it’s real
The way that you make me feel
A burning deep down inside
A love that I cannot hideOur love is you and me baby
That makes the world go ’round
And if you’ve been doin’ lovin’ with me
Layin’ all my troubles downHere I am, baby
Come and take me
Here I am, baby
Come and take me
Take me by the hand
Show me
Here I am, baby— Al Green
Here I Am
Unit and Nothingness
On a different note…
1. On Procedures and Functions
In FORTRAN and Pascal and Ada, programming languages that I revelled in long ago, there is a distinction drawn between so-called procedures on the one hand and functions on the other. Both are software constructs for doing some work, but whereas a function calculates a tangible result and gives it back to the caller, a procedure does no such thing, performing instead some background operation on behalf of the caller (for instance printing some text to the screen or saving some data in a database).
So in Ada you might write
function Translate( english_word : String ) return String is begin ...translation algorithm here... return swahili_word; end
and
procedure Display( sentence : String ) is begin ...output algorithm here... end
In a sense, functions produce stuff that you can take with you whereas procedures just do stuff.
2. Unifying Them Both
In contrast to this, the languages C, C++, C# and Java have no such distinction. They only have functions.
Well, that’s not quite right, because of course there’s still a need for algorithms that do stuff. And so in place of procedures, these languages define so-called void functions. They produce nothing whence void.
In a hypothetical language might this could take the following form.
function Display( sentence : String ) return void is begin ...output algorithm here... end
To an engineer encountering this stuff for the first time, this notion of void functions is entertaining. It’s novel to reflect on the notion that the void has entered into an otherwise dry world of physics and equations of motion and all that.
But it’s not a confusing concept, so after a few minutes the novelty fades, and you proceed as you always have, writing some functions that produce something and other procedures functions that don’t.
3. void Isn’t a Type
Now, the languages mentioned above are examples of so-called statically typed languages. That is to say, every algorithm expressed in these languages manipulates things that have a so-called type (String, Integer, Character, …), and these types are explicitly specified by the programmer. So you might wonder, What is this type called void?
Well, I am not a programming expert, but my understanding is that in fact in these cases, void isn’t really a type per se. It’s just a hint to the computer that this particular function actually doesn’t return anything.
Hm… It’s a hint that this function isn’t producing anything; that it’s only doing something. In other words, void is just an annotation that says, Hah! Fooled you. This isn’t really a function at all; it’s a procedure.
4. Introducing Unit
This state of affairs changes a bit in the Scala programming language, a language built on the conceptual foundations of C and Java but one that goes in some fundamentally different directions.
Scala generalizes the notion of void to a full-fledged type called Unit. So in Scala you might write something like this.
def Display( sentence : String ) : Unit =
{
...output algorithm here...
}
Or using the Ada-like pseudocode we’ve used above,
function Display( sentence : String ) return Unit is begin ...output algorithm here... end
The only real difference here is the presence of Unit instead of void. But in Scala, this is no minor detail. Whereas the void of C is a kind of hint, Scala’s Unit is a bonafide type.
5. A Tangent on the Notion of Unit
Unit made me do a double-take when I first saw it. After all, using Unit to represent “nothing” sounds perilously close to the heresy of claiming that 1=0. It turns out that I’ve run into this heresy before.
Once upon a time I was working with a bunch of rocket scientists. We were building a new space transportation system that was going to take us to orbit, take us to the moon and eventually take us to Mars. One of the projects I was working on involved designing a schema for representing complex datasets in a way that future engineers and software developers could understand long after the original authors were gone. (This system was being designed for the long-haul, an irony given that the project was eventually cancelled.)
I worked with a couple computer science-y, math-y guys from California. They were bright, and they were determined to apply their dreams of ontologies to the problem I was working on. One day we were discussing how to specify … nothing — how to formally indicate that there was nothing there there.
“Can we call this Unit?” Oliver asked.
I was puzzled. Why would we call nothing one?
See the connection, here?
6. Another Tangent
I’m not a computer scientist. Indeed, in an interview question long ago, I was asked some computer science-y, algorithm-theoretical question to which said, “I confess I’m not strong in …” to which the questioner responded, “Aren’t all computer scientists strong in …?” to which I reminded him that my background was in engineering.
Neither am I a mathematician. But let me point out something about Monoids. In abstract algebra, a monoid is a pair (S,op) where S is some set and op is a binary operation (function) on that set that returns elements of the set. There are some axioms surrounding S and op, namely the axioms of closure, associativity and identity.
It’s the notion of identity that is relevant, here. The identity axiom simply stipulates that there is some element in the set S, let’s call it I, for which (I op x) = x for all elements x in S.
Hmm… This is a bit abstract. But wait, don’t leave.
Let’s consider the case where op is the binary operation of adding two numbers together. In this case, I is 0 (zero), since any number plus zero gives you the original number.
Now let’s consider the case where op is the binary operation of multiplying two numbers together. Here, I is 1 (one), since any number times one gives you the original number.
And are you seeing my point, here? When those ontology guys asked me if it was ok to use the term “unit” to refer to “nothing,” it must have had something to do with monoids. Unit must be related to some theoretical notion of identity, and in the context of multiplication, the notion of identity is indeed… one. Hence the term unit?
Anyway, let’s return to Scala’s type system…
7. Unit and Nothing
So Scala has this thing called Unit. It’s a type in the language used in situations where a function actually returns nothing.
In some sense Unit means nothing. Personally, I would have chosen Nothing rather than Unit as way to say …you know… “nothing”. But it turns out that the type Nothing is used in Scala for something else.
Nothing is one of the so-called bottom types in the language. It is a subtype of every other type in the language. And rather than denoting “nothing” as the term suggests, Nothing actually denotes “never”. When a function is intentionally designed never to return you specify its return type as Nothing. Personally, I would have chosen …you know… Never to capture this. But remember, I am not a computer scientist.
Using the same pseudocode as above, you might write such a function as follows.
function Event_Loop() returns Nothing is begin while(true) begin ...event processing here... end end
You can see from that never-terminating loop that the function never returns, it just loops around again and again, processing events ad infinitum. (You have to admit, return Never would have fit this situation really well.)
Admittedly, all this one is nothing and nothing is never is… well, confusing. But frankly, once you get passed this minor hurdle, the details of the Scala type system are frankly stunning.
But that, dear reader, is a topic for another day.
Mercury Rising
…and in the National Gallery of Art, we saw Mercury rising:

White House Garden Tour
Did I tell you about the garden tour?
What garden tour?
I guess I didn’t tell you. Do you want to know about it?
Actually, I…
We had gone to Washington, D.C. to visit friends who had moved there. We went to see Melissa and Carlyle and Trudy’s friend Karen who was following her boss who had taken a cabinet secretary position. And it turned out that the White House liaison in the agency was giving out tickets to the fall Whitehouse garden tour.
…but I…
We felt so… connected. How many degrees of separation from the President would that have been. Certainly only a few. We were tickled to have tickets. To be in the know.
…I see.
So we met Karen and took the metro to the White House. And when we got there, we should have known something was not quite right.
…not quite right?
Well not not quite right. I mean, not wrong. But it wasn’t as we thought. You see we had these invitations and were feeling all smug, and then we got there, and there was a very, very long line. This was not exactly a small affair. In fact, there were two lines with Park Service rangers asking if we had 1:00 or 1:30 invitations and directing us to the 1:30 line.
…that’s a shame.
But not really a shame, because the line move quickly and the people were generally in a good mood and although it was chilly in the shade, the sky was blue and the sun was shining…
…of course, blue sky and shining sun.
…and the grass was green.
..right.
So we eventually got in and gazed in earnest admiration at the various trees planted by the various presidents over the years. And we filed by the south portico.

…very nice.
And we peered into The Rose Garden and gawked at the empty podium there.

I mean this is really six degrees of separation stuff, right? What, the day before he must have been out there talking to…
…to someone.
Precisely. So anyway, we walked past the White House and admired the west side of the south lawn. There were more trees there, …

…more trees.
and we could see the Old Executive Office Building just nearby. (I’ve always been a pushover for that building.)

…of course.
Did you know that from the South Lawn you look past a fountain across the Ellipse to the Washington Monument?
…I think I knew that.
And that from there you look out across the Tidal Basic at the Jefferson Memorial?
…I didn’t…
I didn’t either. And so I must confess that this is the reason I wanted to tell you this. I wanted to tell you what a spectacular view that was, standing there beside the lush green grass of the White House South Lawn on a sunny, cloudless fall day with the White House itself behind us

gazing to the south at the Washington Monument wrapped in protective scaffolding ever since the earthquake, gazing at the Jefferson Memorial

… thru the Jefferson Memorial, because we could see daylight on the other side.

As I said, it was a spectacular view.
…very nice.
And there was the Marine Corps band playing at the foot of the hill. And there was the vegetable garden. But here’s what I really wanted to tell you.
…oh.
When we left the South Lawn and began walking around the Ellipse to the Mall, we passed a couple people who were distributing some kind of flyers. They looked like students. They had badges hanging from their necks, and they had that youthful college intern look.
…ah.
And as we got up to them, they held out the flyers to us and asked us, “Do you need tickets to the garden tour?”
…um.
The three of us looked at each other. These two interns were holding thick stacks of Fall White House Garden Tour invitations. The same select invitations that got us in. All of the sudden, we didn’t feel quite so … connected.
But whatever. We had a good time, and it was a beautiful day. We left the White House behind us and headed toward the National Gallery of Art.
…which can be a story for some other time, right?
Sure.
Fairness
Ok, so this isn’t fair.
We’re up at 5:45am. Before the rising of the sun. Before the rising of the dogs. We’re out of the house by 6:32. To go running. Six miles for the fair and industrious Trudy. Ten for me, although truth be told, the hills and progression miles took their toll and had me walking in spurts at the end so ten is not likely an accurate count. But you get the idea.
And then we’re out running errands. Acupuncture appointments. Baby gifts for Alex and Kim next door. Reflective running gear for those runs in the dark that will come next week and next and next. And although Trudy managed to sneak in a nap or two in the middle of the day, I didn’t. Concentrating as I was in front of the computer for a while on VirtualBox and Vagrant and Puppet and yum updates that are failing because nothing needs updating.
So at the end of the long day, I finally lay me down to sleep. But no. No sleep.
Wide eyes. Stevie Wonder bouncing thru my brain, because I had the temerity to actually play some music on the stereo yesterday (my brother would be proud) and Masterblaster was the last thing I played and my brain is evidently stuck in infinite replay mode.
No sleep. As Trudy breathes long in-and-out breaths, I’m thinking of SQL queries. And the hedge in the back that needs clipping. And the pergola that’s going to fall down any day now. And the irises that need to be dug up and clipped. And the two Bluebonnets that I saw sprouting next to the tomatoes that froze the other night before it got to be in the 80s today. And the compost piles that need to be consolidated. And wouldn’t it be nice to have different house numbers on the outside of the house under the light thrown down by our new sconces?
It isn’t fair.
Afternoon Break
1. No Sign Up
It was afternoon. The room was dark. I was starting at the computer screen. I’d been working on this query all day, and it wasn’t coming together.
In the hall, some people were talking. Something about coming up from downstairs. Something about not signing in. Something about a chair massage.
“What?” I said, turning around and looking at them. “We don’t have to sign in?”
I had seen the email about chair massages and signing up. But as with so much that comes into my inbox, it went in one ear and out the other, and I never did sign up.
“No,” Terri said. “Not many people signed up. They’re just standing around down there.”
“What room?”
“Harris.”
“You don’t have to tell me twice.”
I heard them laughing as I turned the corner.
2. In Harris
Harris was dark.
Was it too late? Had they already left? I pulled the frosted glass door open.
There was soft music playing somewhere in the front.
In a corner in the back, there was a massage chair with someone in it. The therapist looked up at me and smiled. I waved back.
In the front, there was a second chair with someone in it. And there was a third, empty chair and a woman in scrubs sitting next to it reading.
She heard me coming and stood up smiling.
“Are you ready?”
“I didn’t sign up.”
“That’s ok. Have a seat.”
3. Died And Gone to Heaven
I have heard of this before. Stories of software companies in the peak of the dot-com boom. Startups treating their employees to chair massages. I had a friend who left the space business to work at one of those companies. He used to tell us stories about those heady days.
But I missed those days, making the jump just as the bottom fell out. I missed the chair massages.
Until today.
Ten minutes. A perfect way to get that query out of my head.
Afterwards, as I was returning to the quiet and the darkness of our corner of the second floor, I passed thru the kitchen, and there on the counter were two big plates of fruit.
Apple slices. Pineapple chunks. Purple grapes. Big read strawberries. Sitting there on the counter. There for the taking. After a chair massage.
How about that? I must have died and gone to heaven.
© jumpingfish by David Hasan is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License


