Curious about method handling

James Reeves <[email protected]> Thu, 4 Aug 2005 20:54:18 +0100
Newsgroups gmane.comp.lang.nice.general
Message-ID <[email protected]>
Hello there!

I'm new to the list, and to Nice in general, but I've been quite intrigued by 
the language for a few weeks now. I've always liked Java's many libraries, 
but I've always been horrified by its rather primitive syntax. Nice combines 
the best of both worlds; it feels like everything Java *should* have been.

So I'm rather impressed, but I do have a few questions. Some syntax about 
methods confuses me. I think it's best explained with an example:

String f() = "Hello World";

class A {
  String greeting = "Hello World";
  String g() = this.greeting;
}

void main(String[] args) {
  println( f );
  println( ( new A() ).g );
}

The former command prints "#<procedure f>", whilst the latter prints "Hello 
World". Why the difference in syntax between class methods and non-class 
methods?

Also, is there any way of passing a class method as an argument without 
wrapping it in an anonymous method?

--
James Reeves
http://www.monkeyengines.co.uk/


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf