[Haskell-cafe] extending the notion of notation (was: extending Do notation)

MigMit miguelimo38 at yandex.ru
Wed May 21 04:41:06 UTC 2014

> > Incorrect. There are programs in pseudocode, programs for MIX, programs for machines they don't make anymore. Ada Lovelace created some programs for Babbidge's machine. Program can be buggy, or unfinished. Neither of these types of programs can be executed, but they are still programs. 
> Incorrect. Those are all representations of programs.

Of what programs?

>  Whether they can or can't be executed is immaterial to that status. As I said, it's common to call a representation of a program a program as well, because the context lets the reader sort it out. But in this context, it matters, because we're talking about alternative representations for programs.

No, it doesn't, because there are no alternative representations and, most of the time, nothing to represent.

I'll elaborate on both points.

Let's start with the second part.  The executable, compiled from source (even if compilation IS possible) depends on overwhelming amount of variables. Compiler. It's version. Operating system. Optimization flags. Libraries' versions (not to mention that libraries, as binaries, also depend on a lot of things). Linker. Hardware platform. Etc. There is NOTHING common to all possible binaries produced by compiling the same source. Therefore, there is nothing to represent.

Now, about there being no alternative representations.

It's true that small changes of syntax usually don't really change the program. In the same way as changing "Philosopher's stone" to "Sorcerer's stone" in US didn't really change the first Harry Potter book. That doesn't mean syntax is irrelevant. Program conveys some meaning, and syntax plays it's part. Joining the chapters of the book together, for instance, will make it less readable. The simplest programming example probably is

quicksort (x:xs) =
  [y | y <- xs, y < x] ++
  x ++
  [y | y <- xs, y >= x]

This can be written in one line, and AST would be the same. But the layout here emphasizes the symmetry of algorithm, helping the author to express the meaning of what he is doing.

Now, that's a very simple example, of course, but things like that are everywhere. No other represenation can capture such details, and they matter.

So, there are no alternative representations. There could be some other views of the program — like graphical class hierarchies — but they aren't "representations", as the chart presented by company's top managers to shareholders is not the representation of all the company's documentation.

Of course, you can actually start from some other "representation" — for example, graphical. That would be like writing a novel by drawing pictures.

More information about the Haskell-Cafe mailing list