Dimensionality of program code

Stewart Gordon smjg_1998 at yahoo.com
Sat Jan 19 10:01:29 PST 2013


On 18/01/2013 21:50, Jeff Nowakowski wrote:
<snip>
> I think you dismiss the embedded space too easily. We call a plot laid
> out in 2D is a 2D-plot. You use both dimensions to specify it.

But does "plot" mean the curve or the whole diagram?

<snip>
> Even a 2D picture can (and often is) represented as a series of ones and
> zeroes. That doesn't mean the essential 2D aspects of it don't exist. To
> say that the 2D layout of block structures "means nothing" is misguided.

The program structure is not defined by this layout.  It's defined by 
the curly brackets.

> It's fundamentally there, just like the 2D picture that's been serialized.

But the whole essence of a picture is that it's two-dimensional.  In a D 
program you can escape all line breaks within strings, cut out all 
comments (or turn all // comments into /*..*/ comments), and then remove 
all line breaks that remain, and it will still be essentially the same 
program.  You can't do that with a picture.

>> OTOH, because we tend to view code in a two-dimensional form, and even
>> rely on line breaks and block indentation to make code readable, I can
>> understand people thinking of code as 2D.
>
> We can rely on it because the 2D aspect is there in structured code,
> even if the compiler doesn't force this layout.
<snip>

Structure and visual layout are two fundamentally different things.

Stewart.


More information about the Digitalmars-d mailing list