On Tue, Feb 8, 2011 at 9:02 PM, <kevin@froglingo.com> wrote:
On Tue, Feb 8, 2011 at 07:55 pm, Conal Elliott <conal@conal.net> wrote:
Here's my personal denotational answer to question 2: I think of a type as denoting a collection of (mathematical) values. If an expression e has type T, then the meaning (value) of e is a member of the collection denoted by T. This simple principle, which is fundamental to how I think of functional programming, has consequences in library design, which I've discussed at http://conal.net/blog/posts/notions-of-purity-in-haskell/ .
When we consider a class of partial recursive functions as the type T, then what are the expressions (such as e in your statement above) for T?
It seems that the type definition missed operations. For example, if a and b are two variables declared as integers, then we would not know how to calculate a + b if the type integers didn't include the plus operator.
Defining a type as a set of values and a set of operations on the values is perfectly fine mathematically. But in the context of programming languages, a type seems to need its syntax anyhow in addition to be a set of values and a set of operations on the values. For example the type definition in C:typedef mydata {int a;char c;}The definition itself is the syntax while we may view the infinite many records {<0, 'a'>, <2, 'a'>, ..., <0, 'b>, ....} as its semantics (or the semantics was called a type earlier).