<?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"
	>
<channel>
	<title>Comments for The Weblog of Peter Ahé</title>
	<atom:link href="http://digital-sushi.org/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://digital-sushi.org</link>
	<description>Thoughts on language design, API design, compilers, Smalltalk, and Java technology</description>
	<pubDate>Sat, 13 Mar 2010 07:42:15 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.5</generator>
		<item>
		<title>Comment on How to Create a Disk Image Installer for Apple Mac OS X by Create a Disk Image Installer on the Mac &#171; The Braun Blog</title>
		<link>http://digital-sushi.org/entry/how-to-create-a-disk-image-installer-for-apple-mac-os-x/#comment-1776</link>
		<dc:creator>Create a Disk Image Installer on the Mac &#171; The Braun Blog</dc:creator>
		<pubDate>Tue, 09 Feb 2010 03:52:36 +0000</pubDate>
		<guid isPermaLink="false">http://digital-sushi.org/entry/how-to-create-a-disk-image-installer-for-apple-mac-os-x/#comment-1776</guid>
		<description>[...] Peter Ahe’s Blog was helpful in getting me going on the right direction and understanding what was required to get the disk image installer created.  Filed under: Mac Leave a comment     Comments (0) Trackbacks (0) ( subscribe to comments on this post ) [...]</description>
		<content:encoded><![CDATA[<p>[...] Peter Ahe’s Blog was helpful in getting me going on the right direction and understanding what was required to get the disk image installer created.  Filed under: Mac Leave a comment     Comments (0) Trackbacks (0) ( subscribe to comments on this post ) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Declaration-Site Extension Methods by Daniel</title>
		<link>http://digital-sushi.org/entry/declaration-site-extension-methods/#comment-1771</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Wed, 02 Dec 2009 16:33:40 +0000</pubDate>
		<guid isPermaLink="false">http://digital-sushi.org/entry/declaration-site-extension-methods/#comment-1771</guid>
		<description>I'd much rather have declaration-site extension methods than nothing at all.

Java needs to evolve at a faster pace if it wants to remain competitive.

I'm personally only still using Java because I have the inertia of a half million lines of code to deal with.  I'd love to switch to Scala.

It's sad how fast C# is evolving compared to Java.

The "let's not mess with the language or JVM" ideology is doing serious damage to the Java platform.</description>
		<content:encoded><![CDATA[<p>I&#8217;d much rather have declaration-site extension methods than nothing at all.</p>
<p>Java needs to evolve at a faster pace if it wants to remain competitive.</p>
<p>I&#8217;m personally only still using Java because I have the inertia of a half million lines of code to deal with.  I&#8217;d love to switch to Scala.</p>
<p>It&#8217;s sad how fast C# is evolving compared to Java.</p>
<p>The &#8220;let&#8217;s not mess with the language or JVM&#8221; ideology is doing serious damage to the Java platform.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Declaration-Site Extension Methods by Peter Ahé</title>
		<link>http://digital-sushi.org/entry/declaration-site-extension-methods/#comment-1769</link>
		<dc:creator>Peter Ahé</dc:creator>
		<pubDate>Wed, 02 Dec 2009 05:13:46 +0000</pubDate>
		<guid isPermaLink="false">http://digital-sushi.org/entry/declaration-site-extension-methods/#comment-1769</guid>
		<description>Cay,

I don't see the value of extension methods. When I heard that use-site extension methods were proposed in a JSR, I felt I had to propose an alternative solution that wouldn't have the same downsides as the original proposal.

Smalltalk has extension methods and it doesn't make the APIs easier to understand or use.

Cheers,
Peter</description>
		<content:encoded><![CDATA[<p>Cay,</p>
<p>I don&#8217;t see the value of extension methods. When I heard that use-site extension methods were proposed in a JSR, I felt I had to propose an alternative solution that wouldn&#8217;t have the same downsides as the original proposal.</p>
<p>Smalltalk has extension methods and it doesn&#8217;t make the APIs easier to understand or use.</p>
<p>Cheers,<br />
Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Declaration-Site Extension Methods by Cay Horstmann</title>
		<link>http://digital-sushi.org/entry/declaration-site-extension-methods/#comment-1768</link>
		<dc:creator>Cay Horstmann</dc:creator>
		<pubDate>Tue, 01 Dec 2009 20:29:28 +0000</pubDate>
		<guid isPermaLink="false">http://digital-sushi.org/entry/declaration-site-extension-methods/#comment-1768</guid>
		<description>We've gone through a couple of years of "let's not mess with anything in the language except for super-simple things like strings in switch and binary literals". Then it was "ok, maybe we really need closures so that we can write ParallelArray without a hundred helper methods". And I agree with that--the value gained for the added complexity seems worth it. 

But I don't see the value gain for extension methods, be they use-site or declaration-site. I must be missing something.  

There isn't anything so awful about Collections.sort(list); that we would need a whole new library mechanism, right? In Java 7, one could add forEach, map, etc. to Collections, and we'd just write Collections.map(list, #(f:SomeType) =&#62; expr). Or use a static import. 

Is there some usecase that goes beyond this?</description>
		<content:encoded><![CDATA[<p>We&#8217;ve gone through a couple of years of &#8220;let&#8217;s not mess with anything in the language except for super-simple things like strings in switch and binary literals&#8221;. Then it was &#8220;ok, maybe we really need closures so that we can write ParallelArray without a hundred helper methods&#8221;. And I agree with that&#8211;the value gained for the added complexity seems worth it. </p>
<p>But I don&#8217;t see the value gain for extension methods, be they use-site or declaration-site. I must be missing something.  </p>
<p>There isn&#8217;t anything so awful about Collections.sort(list); that we would need a whole new library mechanism, right? In Java 7, one could add forEach, map, etc. to Collections, and we&#8217;d just write Collections.map(list, #(f:SomeType) =&gt; expr). Or use a static import. </p>
<p>Is there some usecase that goes beyond this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Declaration-Site Extension Methods by Xavi Miró</title>
		<link>http://digital-sushi.org/entry/declaration-site-extension-methods/#comment-1767</link>
		<dc:creator>Xavi Miró</dc:creator>
		<pubDate>Tue, 01 Dec 2009 05:44:16 +0000</pubDate>
		<guid isPermaLink="false">http://digital-sushi.org/entry/declaration-site-extension-methods/#comment-1767</guid>
		<description>Peter,

   you're right. I haven't taken this into account, your proposal (and Neal's proposal) doesn't need to add new methods. My version would only work for adding new methods.

   Regards,

       Xavi</description>
		<content:encoded><![CDATA[<p>Peter,</p>
<p>   you&#8217;re right. I haven&#8217;t taken this into account, your proposal (and Neal&#8217;s proposal) doesn&#8217;t need to add new methods. My version would only work for adding new methods.</p>
<p>   Regards,</p>
<p>       Xavi</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Declaration-Site Extension Methods by Peter Ahé</title>
		<link>http://digital-sushi.org/entry/declaration-site-extension-methods/#comment-1765</link>
		<dc:creator>Peter Ahé</dc:creator>
		<pubDate>Tue, 01 Dec 2009 04:02:56 +0000</pubDate>
		<guid isPermaLink="false">http://digital-sushi.org/entry/declaration-site-extension-methods/#comment-1765</guid>
		<description>Xavi,

With either Neal's or mine proposals, "list.sort()" compiles to "java.util.Collections.sort(list)". This would work on older JREs, where as your version would compile to "java.util.List$extension.sort(list)" which doesn't exist on older JREs.

Cheers,
Peter</description>
		<content:encoded><![CDATA[<p>Xavi,</p>
<p>With either Neal&#8217;s or mine proposals, &#8220;list.sort()&#8221; compiles to &#8220;java.util.Collections.sort(list)&#8221;. This would work on older JREs, where as your version would compile to &#8220;java.util.List$extension.sort(list)&#8221; which doesn&#8217;t exist on older JREs.</p>
<p>Cheers,<br />
Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Declaration-Site Extension Methods by Xavi Miró</title>
		<link>http://digital-sushi.org/entry/declaration-site-extension-methods/#comment-1764</link>
		<dc:creator>Xavi Miró</dc:creator>
		<pubDate>Mon, 30 Nov 2009 20:20:19 +0000</pubDate>
		<guid isPermaLink="false">http://digital-sushi.org/entry/declaration-site-extension-methods/#comment-1764</guid>
		<description>Peter,

   I also think your extension methods proposal is very powerful for API implementors. But, could it be even better if the declaration was simpler ? I mean, instead of having to create the extension methods in a separated class and an import to reference those static methods, why not write the implementation of the static method in the interface itself and let the compiler generate a class (like with inner classes) with all the static methods of the extensions? It would be possible to add a mandatory annotation @extension (or similar) to explicitly remark that the method is to be an extension method.

 It would be something like:

package java.util;
interface List â?¦ {
  â?¦
  @extension
  void sort(){
      // .. Implementation here
      this.someOtherMethod();
   };
  â?¦
}

The compiler would automatically generate a class List$extensions which could contain the implementations of sort and all the other extension methods as static methods. The use of _this_ in the interface extension methods would be replaced by the first argument in the implementation static method:

package java.util;

public class List$extensions {

  public static void sort(List list){
      ...
      list.someOtherMethod();  // -- this =&#62; list
  }
}

  The rest of the proposal would work exactly as you describe, being compatible with older libraries and so on.

  Of course there can be a lot of issues I don't know, I'm not an expert in compilers, but as a Java programmer for me it would be better to have the implementations in the same interface and let the compiler generate the class where static methods will be.

  Only an idea. :-)

  Regards,

      Xavi</description>
		<content:encoded><![CDATA[<p>Peter,</p>
<p>   I also think your extension methods proposal is very powerful for API implementors. But, could it be even better if the declaration was simpler ? I mean, instead of having to create the extension methods in a separated class and an import to reference those static methods, why not write the implementation of the static method in the interface itself and let the compiler generate a class (like with inner classes) with all the static methods of the extensions? It would be possible to add a mandatory annotation @extension (or similar) to explicitly remark that the method is to be an extension method.</p>
<p> It would be something like:</p>
<p>package java.util;<br />
interface List â?¦ {<br />
  â?¦<br />
  @extension<br />
  void sort(){<br />
      // .. Implementation here<br />
      this.someOtherMethod();<br />
   };<br />
  â?¦<br />
}</p>
<p>The compiler would automatically generate a class List$extensions which could contain the implementations of sort and all the other extension methods as static methods. The use of _this_ in the interface extension methods would be replaced by the first argument in the implementation static method:</p>
<p>package java.util;</p>
<p>public class List$extensions {</p>
<p>  public static void sort(List list){<br />
      &#8230;<br />
      list.someOtherMethod();  // &#8212; this =&gt; list<br />
  }<br />
}</p>
<p>  The rest of the proposal would work exactly as you describe, being compatible with older libraries and so on.</p>
<p>  Of course there can be a lot of issues I don&#8217;t know, I&#8217;m not an expert in compilers, but as a Java programmer for me it would be better to have the implementations in the same interface and let the compiler generate the class where static methods will be.</p>
<p>  Only an idea. <img src='http://digital-sushi.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>  Regards,</p>
<p>      Xavi</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Declaration-Site Extension Methods by Daniel</title>
		<link>http://digital-sushi.org/entry/declaration-site-extension-methods/#comment-1762</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Mon, 30 Nov 2009 20:17:55 +0000</pubDate>
		<guid isPermaLink="false">http://digital-sushi.org/entry/declaration-site-extension-methods/#comment-1762</guid>
		<description>I don't like the idea I posted anyway since you couldn't override the default implementation of methods provided for in the interface, so it would still be a shoddy implementation of mixins.

I would very much like to see mixins/traits in Java someday though.

Extension methods are better than nothing, but they are a far cry from ideal.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t like the idea I posted anyway since you couldn&#8217;t override the default implementation of methods provided for in the interface, so it would still be a shoddy implementation of mixins.</p>
<p>I would very much like to see mixins/traits in Java someday though.</p>
<p>Extension methods are better than nothing, but they are a far cry from ideal.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Declaration-Site Extension Methods by Peter Ahé</title>
		<link>http://digital-sushi.org/entry/declaration-site-extension-methods/#comment-1760</link>
		<dc:creator>Peter Ahé</dc:creator>
		<pubDate>Mon, 30 Nov 2009 16:29:35 +0000</pubDate>
		<guid isPermaLink="false">http://digital-sushi.org/entry/declaration-site-extension-methods/#comment-1760</guid>
		<description>Daniel,

Why would it be cleaner?

For example, how would adding methods to interfaces work with older libraries? What changes would be required to the Java virtual machine (JVM) to implement your proposal?

After compiling with Neal's or mine proposals, you get a class file that can run on older versions of the Java platform libraries. Furthermore, both Neal's and mine proposals require no changes to the JVM because adding a new attribute for the compiler does not affect the JVM (it will simply ignore it).</description>
		<content:encoded><![CDATA[<p>Daniel,</p>
<p>Why would it be cleaner?</p>
<p>For example, how would adding methods to interfaces work with older libraries? What changes would be required to the Java virtual machine (JVM) to implement your proposal?</p>
<p>After compiling with Neal&#8217;s or mine proposals, you get a class file that can run on older versions of the Java platform libraries. Furthermore, both Neal&#8217;s and mine proposals require no changes to the JVM because adding a new attribute for the compiler does not affect the JVM (it will simply ignore it).</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Declaration-Site Extension Methods by Daniel</title>
		<link>http://digital-sushi.org/entry/declaration-site-extension-methods/#comment-1758</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Mon, 30 Nov 2009 16:04:14 +0000</pubDate>
		<guid isPermaLink="false">http://digital-sushi.org/entry/declaration-site-extension-methods/#comment-1758</guid>
		<description>I like that syntax and I think it should be supported.

It would be cleaner though if static methods could be added to interfaces though.

And then just add some syntax sugar so that:

interface Foo {
    static int bar( Foo foo, int arg1 ) { return foo.something( arg1 ); }
}

could be optionally written as:

interface Foo {
    void bar( int arg1 ) { return something( arg1 ); }
}

Basically any non-static method on an interface would be modified to generate a static method that takes an interface argument as its first argument implicitly.

This would give us extension methods with a syntax that was very mixin-ish.  It would also give us the ability to add static methods on interfaces which would be useful in its own right.</description>
		<content:encoded><![CDATA[<p>I like that syntax and I think it should be supported.</p>
<p>It would be cleaner though if static methods could be added to interfaces though.</p>
<p>And then just add some syntax sugar so that:</p>
<p>interface Foo {<br />
    static int bar( Foo foo, int arg1 ) { return foo.something( arg1 ); }<br />
}</p>
<p>could be optionally written as:</p>
<p>interface Foo {<br />
    void bar( int arg1 ) { return something( arg1 ); }<br />
}</p>
<p>Basically any non-static method on an interface would be modified to generate a static method that takes an interface argument as its first argument implicitly.</p>
<p>This would give us extension methods with a syntax that was very mixin-ish.  It would also give us the ability to add static methods on interfaces which would be useful in its own right.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
