Last updated : 12/01/2003; 16:03:32

Joe's Jelly

Joe Walnes rambling on and on about Software Development, Java and Extreme Programming.

NAVIGATION >>

/WIKI /WEBLOG /THOUGHTWORKS /OPENSYMPHONY /EMAIL

:: ELSEWHERE
xp developer wiki
c2 xp wiki
the server side
javaworld
sd magazine
jakarta

:: BLOGS
Ara Abrahamian
Mathias Boegart
Mike Cannon-Brookes
Paul Hammant
Aslak Hellesøy
Darren Hobbs
Patrick Lightbody
Charles Miller
Brett Morgan
Rickard Öberg
Joseph Ottinger
Mike Roberts
Chris Stevenson
James Strachan

:: INVOLVEMENTS
SiteMesh
QDox
MockDoclet
OSCore
OSUser
PropertySet
RichTags
Marathon
SiteMesh C++
Alt-RMI
Jelly MockTags
more...
:: BACKLOGS
December 2002
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Nov   Jan



Click here to visit the Radio UserLand website.

Click to see the XML version of this web page.

joe@truemesh.com

:. 09 December 2002

  7:15:22 AM  

Continuing on the thread about adding blocks to Java/C#, two additions:

Ross Judson replies,

Joe knocked one line out of my example that I think is somewhat important...you need to be able to declare higher-order functional types. That's just a function that takes a function that takes a function etc...these are pretty handy for solving certain types of problems. The point is, a function is defined in terms of its inputs and its output. Compatibility is pretty important -- the compiler can verify that two functional types are compatible quite easily.

...

There are plenty of smart people in the functional world. There are plenty of extra cool languages out there (OCaml is one of the most interesting ones, as is Haskell). With Java I think we are in a kind of 90/10 situation -- what key functional features might we add to the language and VM specification that will really help us write better code?

Whatever we choose must have as minimal an impact on the language as possible. Strong typing is a considerable virtue, in my opinion. So are exceptions, so whatever functional notation we choose we will want to support exceptions fully.

class Example {
  public function double ComputeThis(String p1, double p2) throws SomeException;
  public function double SecondOrder(ComputeThis computerThis, double outer) throws SomeException;
} ;

In that example I'm declaring a first and second order function, both of which are declared to throw an exception. We can now call these functions at will and have them participate fully in the exception mechanism. If a function is defined to take another function, it must declare in its throws clause a superset of the exceptions that are thrown by the parameter function (I think).

And Don Box from the .NET team points us to the addition of iterators to C#.

Iterators are pretty cool. They're basically much more convenient ways of defining how the foreach statement should work on an object without having to resort to additional enumerator classes (which are fiddly to write).

public class People {
  public Person foreach() {
    yield(new Person("John"));
    yield(new Person("Fred"));
    yield(new Person("Bill"));
  }
}

To use:

foreach (Person p in people) {
...
}

All this stuff makes the language easier and easier to use. And it's obvious that the next logical step from iterators a more generic support for blocks.

Meanwhile, Java gets assert()...

 


Web-design by John Doe from open source web design.