<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments for Andrew’s Mental Dribbling</title>
	<atom:link href="http://dysphoria.net/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://dysphoria.net</link>
	<description>For long lost friends and stalkers</description>
	<lastBuildDate>Sat, 22 May 2010 15:01:22 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>Comment on Hindley-Milner type inference in Scala by Andrew</title>
		<link>http://dysphoria.net/2009/06/28/hindley-milner-type-inference-in-scala/comment-page-1/#comment-34850</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Sat, 22 May 2010 15:01:22 +0000</pubDate>
		<guid isPermaLink="false">http://dysphoria.net/?p=246#comment-34850</guid>
		<description>Hi Dima,

’Fraid I can’t help; I don’t use Eclipse. Have you tried it from the command-line? Perhaps Eclipse is confused because it is written as a script (see line 304)…?

The code outputs the type of an expression, given an abstract syntax tree representing that expression. However, it does not parse string expressions to create the AST, if that’s what you’re asking. So you can’t run it on arbitrary expressions from the command-line, or anything like that.

Hope that helps,

–Andrew</description>
		<content:encoded><![CDATA[<p>Hi Dima,</p>
<p>’Fraid I can’t help; I don’t use Eclipse. Have you tried it from the command-line? Perhaps Eclipse is confused because it is written as a script (see line 304)…?</p>
<p>The code outputs the type of an expression, given an abstract syntax tree representing that expression. However, it does not parse string expressions to create the AST, if that’s what you’re asking. So you can’t run it on arbitrary expressions from the command-line, or anything like that.</p>
<p>Hope that helps,</p>
<p>–Andrew</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Hindley-Milner type inference in Scala by Robert Smallshire</title>
		<link>http://dysphoria.net/2009/06/28/hindley-milner-type-inference-in-scala/comment-page-1/#comment-34680</link>
		<dc:creator>Robert Smallshire</dc:creator>
		<pubDate>Tue, 13 Apr 2010 10:50:04 +0000</pubDate>
		<guid isPermaLink="false">http://dysphoria.net/?p=246#comment-34680</guid>
		<description>I reimplemented your Scala code in Python for a project I am working on.

http://www.smallshire.org.uk/sufficientlysmall/2010/04/11/a-hindley-milner-type-inference-implementation-in-python/

Thanks for providing a clean implementation in Scala for me to work from; it was much more comprehensible than the Modula-2 or Perl, even though I don&#039;t know Scala and do know Perl.</description>
		<content:encoded><![CDATA[<p>I reimplemented your Scala code in Python for a project I am working on.</p>
<p><a href="http://www.smallshire.org.uk/sufficientlysmall/2010/04/11/a-hindley-milner-type-inference-implementation-in-python/" rel="nofollow">http://www.smallshire.org.uk/sufficientlysmall/2010/04/11/a-hindley-milner-type-inference-implementation-in-python/</a></p>
<p>Thanks for providing a clean implementation in Scala for me to work from; it was much more comprehensible than the Modula-2 or Perl, even though I don&#8217;t know Scala and do know Perl.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Hindley-Milner type inference in Scala by Dima</title>
		<link>http://dysphoria.net/2009/06/28/hindley-milner-type-inference-in-scala/comment-page-1/#comment-34594</link>
		<dc:creator>Dima</dc:creator>
		<pubDate>Wed, 31 Mar 2010 19:15:06 +0000</pubDate>
		<guid isPermaLink="false">http://dysphoria.net/?p=246#comment-34594</guid>
		<description>Hi Andrew,

I tried to run ur code using eclipse under windows. I got the following error

java.lang.NoClassDefFoundError: HindleyMilner

Can you help me regarding this issue. Besides does the code enables inputting an expression and getting its type as output.
Regards</description>
		<content:encoded><![CDATA[<p>Hi Andrew,</p>
<p>I tried to run ur code using eclipse under windows. I got the following error</p>
<p>java.lang.NoClassDefFoundError: HindleyMilner</p>
<p>Can you help me regarding this issue. Besides does the code enables inputting an expression and getting its type as output.<br />
Regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Hindley-Milner type inference in Scala by Christian Klauser</title>
		<link>http://dysphoria.net/2009/06/28/hindley-milner-type-inference-in-scala/comment-page-1/#comment-34122</link>
		<dc:creator>Christian Klauser</dc:creator>
		<pubDate>Tue, 26 Jan 2010 05:09:24 +0000</pubDate>
		<guid isPermaLink="false">http://dysphoria.net/?p=246#comment-34122</guid>
		<description>I keep my source code in a repository at assembla:

http://www.assembla.com/wiki/show/tincal

It is not a working compiler and a lot of things are missing. I haven&#039;t settled on how to encode product and sum types which in turn determines how &quot;value deconstructors&quot; will be implemented. Those in turn are necessary for pattern matching.

At the moment, it is a personal project that I work on from time to time. Don&#039;t know how far I&#039;ll get.</description>
		<content:encoded><![CDATA[<p>I keep my source code in a repository at assembla:</p>
<p><a href="http://www.assembla.com/wiki/show/tincal" rel="nofollow">http://www.assembla.com/wiki/show/tincal</a></p>
<p>It is not a working compiler and a lot of things are missing. I haven&#8217;t settled on how to encode product and sum types which in turn determines how &#8220;value deconstructors&#8221; will be implemented. Those in turn are necessary for pattern matching.</p>
<p>At the moment, it is a personal project that I work on from time to time. Don&#8217;t know how far I&#8217;ll get.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on UTF-8 A-Go-Go by Oleg Kuznetsov</title>
		<link>http://dysphoria.net/2006/02/05/utf-8-a-go-go/comment-page-1/#comment-33944</link>
		<dc:creator>Oleg Kuznetsov</dc:creator>
		<pubDate>Mon, 28 Dec 2009 01:25:53 +0000</pubDate>
		<guid isPermaLink="false">http://dysphoria.net/?p=51#comment-33944</guid>
		<description>DBD::mysql v4.011 supports {mysql_enable_utf8 =&gt; 1} key, but it does not setup utf8 flag, unfortunately =(

perl 5.10
dbi 1.609</description>
		<content:encoded><![CDATA[<p>DBD::mysql v4.011 supports {mysql_enable_utf8 =&gt; 1} key, but it does not setup utf8 flag, unfortunately =(</p>
<p>perl 5.10<br />
dbi 1.609</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on It’s Just A Flesh Wound! by Andrew</title>
		<link>http://dysphoria.net/2005/05/04/its-just-a-flesh-wound/comment-page-1/#comment-33152</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Wed, 18 Nov 2009 22:32:03 +0000</pubDate>
		<guid isPermaLink="false">http://dysphoria.net/2005/05/04/14/#comment-33152</guid>
		<description>Norman Wisdom… Or Benny Hill. In a flash of genius, someone’s dubbed the Benny Hill theme over the ‘Battle of Naboo’ sequence from Revenge of The Sith.

It’s hilarious. It also fits the scene perfectly, as shot.

http://www.youtube.com/watch?v=kYfibSaDHrM</description>
		<content:encoded><![CDATA[<p>Norman Wisdom… Or Benny Hill. In a flash of genius, someone’s dubbed the Benny Hill theme over the ‘Battle of Naboo’ sequence from Revenge of The Sith.</p>
<p>It’s hilarious. It also fits the scene perfectly, as shot.</p>
<p><a href="http://www.youtube.com/watch?v=kYfibSaDHrM" rel="nofollow">http://www.youtube.com/watch?v=kYfibSaDHrM</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Hindley-Milner type inference in Scala by Andrew</title>
		<link>http://dysphoria.net/2009/06/28/hindley-milner-type-inference-in-scala/comment-page-1/#comment-32831</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Sun, 08 Nov 2009 21:09:35 +0000</pubDate>
		<guid isPermaLink="false">http://dysphoria.net/?p=246#comment-32831</guid>
		<description>Actually, let me retract that: ‘Type’ is not necessary coupled to the type inference algorithm, so, yes, a ‘bind’ method, which checks that the variable is not already bound (or which walks the list to the last unbound variable in the chain) before assigning ‘instance’ would make sense.</description>
		<content:encoded><![CDATA[<p>Actually, let me retract that: ‘Type’ is not necessary coupled to the type inference algorithm, so, yes, a ‘bind’ method, which checks that the variable is not already bound (or which walks the list to the last unbound variable in the chain) before assigning ‘instance’ would make sense.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Hindley-Milner type inference in Scala by Andrew</title>
		<link>http://dysphoria.net/2009/06/28/hindley-milner-type-inference-in-scala/comment-page-1/#comment-32830</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Sun, 08 Nov 2009 21:01:19 +0000</pubDate>
		<guid isPermaLink="false">http://dysphoria.net/?p=246#comment-32830</guid>
		<description>Bill,

I see what you’re saying.

Though in actual fact, the missed call to prune was in ‘occursintype’ which is used in a couple of places, notably ‘fresh’ (which creates new type variables from generic ones if necessary), not just in ‘unify’.

The way the algorithm works, the assignment to ‘instance’ should never be performed on anything other than an unbound type variable. So your setter method could just &lt;code&gt;assert(instance == null); instance = newValue;&lt;/code&gt;. The ‘Type’ class is already tightly bound to the type inference algorithm, so you might as well implement ‘unify’ and ‘prune’ (and possibly some other functions) as methods on Type, instead of exposing ‘instance’ at all.

Cheers,

–Andrew</description>
		<content:encoded><![CDATA[<p>Bill,</p>
<p>I see what you’re saying.</p>
<p>Though in actual fact, the missed call to prune was in ‘occursintype’ which is used in a couple of places, notably ‘fresh’ (which creates new type variables from generic ones if necessary), not just in ‘unify’.</p>
<p>The way the algorithm works, the assignment to ‘instance’ should never be performed on anything other than an unbound type variable. So your setter method could just <code>assert(instance == null); instance = newValue;</code>. The ‘Type’ class is already tightly bound to the type inference algorithm, so you might as well implement ‘unify’ and ‘prune’ (and possibly some other functions) as methods on Type, instead of exposing ‘instance’ at all.</p>
<p>Cheers,</p>
<p>–Andrew</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Hindley-Milner type inference in Scala by Bill Hails</title>
		<link>http://dysphoria.net/2009/06/28/hindley-milner-type-inference-in-scala/comment-page-1/#comment-32825</link>
		<dc:creator>Bill Hails</dc:creator>
		<pubDate>Fri, 06 Nov 2009 11:37:16 +0000</pubDate>
		<guid isPermaLink="false">http://dysphoria.net/?p=246#comment-32825</guid>
		<description>Hi Andrew

&gt; Line 271 of the Perl code implements unifies a type variable with its
&gt; inferred value, so it’s quite essential :)

Absolutely agree, but... :-)

&gt; You could wrap it in an setter method if you like (is that what you
&gt; meant?), but that doesn’t change the behaviour of the algorithm.

Yes that&#039;s what I meant. My real argument is that it&#039;s dangerous *not* to wrap the assignment to a logic variable in a setter method.

In the standard(?) implementation of Logic Variables, they arrange themselves in chains. For instance assume some language with LVs:

# create an empty LV
declare A;
# result A-&gt;(empty)

# create another empty LV
declare B;
# result: B-&gt;(empty)

# unify A with B
A = B;
# result: A-&gt;B-&gt;(empty)

# unify A with 1
A = 1;
# result: A-&gt;B-&gt;1

The point then is that naive assignment directly to A here would not achieve the desired result, instead you would end up breaking the association of A and B giving

A-&gt;1
B-&gt;(empty)

The setter method must chain down the list from A to B until it finds a pointer to (empty) and assign there.

&quot;Pruning&quot; as I understand it is just that action of chaining down the list, but it is presented in the Perl algorithm at least as being a separate step from the assignment. So if as in the perl case it was forgotten, we get the bug you detected.</description>
		<content:encoded><![CDATA[<p>Hi Andrew</p>
<p>&gt; Line 271 of the Perl code implements unifies a type variable with its<br />
&gt; inferred value, so it’s quite essential :)</p>
<p>Absolutely agree, but&#8230; :-)</p>
<p>&gt; You could wrap it in an setter method if you like (is that what you<br />
&gt; meant?), but that doesn’t change the behaviour of the algorithm.</p>
<p>Yes that&#8217;s what I meant. My real argument is that it&#8217;s dangerous *not* to wrap the assignment to a logic variable in a setter method.</p>
<p>In the standard(?) implementation of Logic Variables, they arrange themselves in chains. For instance assume some language with LVs:</p>
<p># create an empty LV<br />
declare A;<br />
# result A-&gt;(empty)</p>
<p># create another empty LV<br />
declare B;<br />
# result: B-&gt;(empty)</p>
<p># unify A with B<br />
A = B;<br />
# result: A-&gt;B-&gt;(empty)</p>
<p># unify A with 1<br />
A = 1;<br />
# result: A-&gt;B-&gt;1</p>
<p>The point then is that naive assignment directly to A here would not achieve the desired result, instead you would end up breaking the association of A and B giving</p>
<p>A-&gt;1<br />
B-&gt;(empty)</p>
<p>The setter method must chain down the list from A to B until it finds a pointer to (empty) and assign there.</p>
<p>&#8220;Pruning&#8221; as I understand it is just that action of chaining down the list, but it is presented in the Perl algorithm at least as being a separate step from the assignment. So if as in the perl case it was forgotten, we get the bug you detected.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Hindley-Milner type inference in Scala by Andrew</title>
		<link>http://dysphoria.net/2009/06/28/hindley-milner-type-inference-in-scala/comment-page-1/#comment-32694</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Mon, 02 Nov 2009 22:47:33 +0000</pubDate>
		<guid isPermaLink="false">http://dysphoria.net/?p=246#comment-32694</guid>
		<description>Hi Bill,

It’s been a while since I’ve looked at this, but I think I’m right in saying:

The core type inference algorithm certainly does not require a distinction between let and lamda. That is: you’re perfectly free to add in a rewrite step which transforms ‘let’ into ‘lambda’, and remove ‘let’ handling by the type inferencer completely. The included AST is just a little toy language to show off that the type inference works.

Line 271 of the Perl code implements unifies a type variable with its inferred value, so it’s quite essential :)

You could wrap it in an setter method if you like (is that what you meant?), but that doesn&#039;t change the behaviour of the algorithm.

If more generally you mean that you’d rather have an implementation which only used immutable objects, and did not have the mutation which you point out on line 271… that too is possible. As Christian Klauser points out above, it’s trickier in a pure functional environment, but quite possible; you just have to maintain a map of type variables to their bound types. The Cardelli paper calls this the ‘set of assumptions’ (page 13). However, the Perl implementation, and my Scala implementation, mutate the type variable objects instead of maintaining a separate map.

Hope this helps!

–A</description>
		<content:encoded><![CDATA[<p>Hi Bill,</p>
<p>It’s been a while since I’ve looked at this, but I think I’m right in saying:</p>
<p>The core type inference algorithm certainly does not require a distinction between let and lamda. That is: you’re perfectly free to add in a rewrite step which transforms ‘let’ into ‘lambda’, and remove ‘let’ handling by the type inferencer completely. The included AST is just a little toy language to show off that the type inference works.</p>
<p>Line 271 of the Perl code implements unifies a type variable with its inferred value, so it’s quite essential :)</p>
<p>You could wrap it in an setter method if you like (is that what you meant?), but that doesn&#8217;t change the behaviour of the algorithm.</p>
<p>If more generally you mean that you’d rather have an implementation which only used immutable objects, and did not have the mutation which you point out on line 271… that too is possible. As Christian Klauser points out above, it’s trickier in a pure functional environment, but quite possible; you just have to maintain a map of type variables to their bound types. The Cardelli paper calls this the ‘set of assumptions’ (page 13). However, the Perl implementation, and my Scala implementation, mutate the type variable objects instead of maintaining a separate map.</p>
<p>Hope this helps!</p>
<p>–A</p>
]]></content:encoded>
	</item>
</channel>
</rss>

