On Tue, Feb 8, 2011 at 9:02 PM,  <span dir="ltr">&lt;<a href="mailto:kevin@froglingo.com">kevin@froglingo.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div class="im"><div><font color="#0000ff" face="Verdana" size="2"></font> </div>
<div><font color="#0000ff"><font size="1"><font color="#000000">On Tue, Feb 8, 2011 at 07:55 pm,  Conal Elliott &lt;<a href="mailto:conal@conal.net" target="_blank">conal@conal.net</a>&gt;</font><font color="#000000"> wrote:</font></font></font><br>

<blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">Here&#39;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&#39;ve discussed at <a href="http://conal.net/blog/posts/notions-of-purity-in-haskell/" target="_blank">http://conal.net/blog/posts/notions-of-purity-in-haskell/</a> .<br>

</blockquote></div>
</div><div>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?</div></blockquote><div><br>There are many, including application of those functions and to those functions (in a language with higher-order functions), as well as variables &amp; primitive constants. The grammar and type system mediates the legal expressions.<br>

 </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div> 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&#39;t include the plus operator.</div>

</blockquote><div><br>The original note didn&#39;t ask how to assign meanings to expressions, but denotational semantics (DS) is a clear &amp; simple methodology. Meanings are defined compositionally. For instance, the meaning of &quot;A + B&quot; is a function of the meanings of the expressions A and B. Typically, DS is described as being functions on syntax, but syntax is just one data type, and I find it very useful for giving semantics to data types, in the same compositional style. For several examples, see <a href="http://conal.net/papers/type-class-morphisms">http://conal.net/papers/type-class-morphisms</a> .<br>

<br>  - Conal<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><br></div>
<div>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:</div>


<div> </div>
<div>typedef  mydata {</div>
<div>int a;</div>
<div>char c;</div>
<div>}</div>
<div> </div>
<div>The definition itself is the syntax while we may view the infinite many records {&lt;0, &#39;a&#39;&gt;, &lt;2, &#39;a&#39;&gt;, ..., &lt;0, &#39;b&gt;, ....} as its semantics (or the semantics was called a type earlier). </div>


</blockquote></div><br>