I do want to write down some thoughts about preaching in the next day or so, partly in response to Naomi’s intriguing query, partly so that I’ve articulated and catalogued some of my thoughts in preparation for next week’s classes. Just now, though, I’m spiritually becalmed, having spent the morning at the bedside of a colleague in a Skokie hospice. Jeff’s vigil is over, now, as our friend died peacefully, escorted by prayers from everyone here at Seabury and from very many others in the Episcopal Church.
Posted by AKMA at June 17, 2003 04:09 PM | TrackBackMy condolences. I am glad it was a peaceful passing, but it was a passing nonetheless, and it is never easy for those left behind. Pax.
Posted by: Rana at June 20, 2003 12:23 PMWe can see an example of this in our code we've written so far. In each function's block, we declare variables that hold our data. When each function ends, the variables within are disposed of, and the space they were using is given back to the computer to use. The variables live in the blocks of conditionals and loops we write, but they don't cascade into functions we call, because those aren't sub-blocks, but different sections of code entirely. Every variable we've written has a well-defined lifetime of one function.
Posted by: Court at January 12, 2004 07:08 PMWe can see an example of this in our code we've written so far. In each function's block, we declare variables that hold our data. When each function ends, the variables within are disposed of, and the space they were using is given back to the computer to use. The variables live in the blocks of conditionals and loops we write, but they don't cascade into functions we call, because those aren't sub-blocks, but different sections of code entirely. Every variable we've written has a well-defined lifetime of one function.
Posted by: Court at January 12, 2004 07:08 PMSince the Heap has no definite rules as to where it will create space for you, there must be some way of figuring out where your new space is. And the answer is, simply enough, addressing. When you create new space in the heap to hold your data, you get back an address that tells you where your new space is, so your bits can move in. This address is called a Pointer, and it's really just a hexadecimal number that points to a location in the heap. Since it's really just a number, it can be stored quite nicely into a variable.
Posted by: Dolora at January 12, 2004 07:08 PMFor this program, it was a bit of overkill. It's a lot of overkill, actually. There's usually no need to store integers in the Heap, unless you're making a whole lot of them. But even in this simpler form, it gives us a little bit more flexibility than we had before, in that we can create and destroy variables as we need, without having to worry about the Stack. It also demonstrates a new variable type, the pointer, which you will use extensively throughout your programming. And it is a pattern that is ubiquitous in Cocoa, so it is a pattern you will need to understand, even though Cocoa makes it much more transparent than it is here.
Posted by: Eliza at January 12, 2004 07:09 PMWhen the machine compiles your code, however, it does a little bit of translation. At run time, the computer sees nothing but 1s and 0s, which is all the computer ever sees: a continuous string of binary numbers that it can interpret in various ways.
Posted by: Lucy at January 13, 2004 11:52 AMWhen a variable is finished with it's work, it does not go into retirement, and it is never mentioned again. Variables simply cease to exist, and the thirty-two bits of data that they held is released, so that some other variable may later use them.
Posted by: Gervase at January 13, 2004 11:52 AMEarlier I mentioned that variables can live in two different places. We're going to examine these two places one at a time, and we're going to start on the more familiar ground, which is called the Stack. Understanding the stack helps us understand the way programs run, and also helps us understand scope a little better.
Posted by: Benjamin at January 13, 2004 11:52 AM