[OSM-dev] Re: osmeditor2 to Java, and a common Java OSM client library
Immanuel Scholz
immanuel.scholz at gmx.de
Fri Jun 2 13:40:22 BST 2006
Hi,
> Here's a classic example: Write a bit of code "foo" that takes a number
> n and returns a structure that -- given an argument i -- returns n
> incremented by i. Just *try* to do that in less than 15,000 lines of
> Java!
Well, I'll do it in 14,994 lines less as you estimated:
class Inc {
private int n;
public Inc(int n) {this.n = n;}
public int inc(int i) {return n+=i;}
}
public Inc foo(int n) {return new Inc(n);}
Including certain constructs (functions beeing first-level objects, inline
function declaration) in the language specification is not always a good
decision, since it make the language itself more complex. Best example for
this is the huge discussion about multiple inheritance in C++ which some
designers think of a bad idea.
For ruby however, lambda's is a good thing! ;-)
Ciao, Imi
More information about the dev
mailing list