[Nice-commit] Nice/web manual.xml,1.38,1.39
Brought to you by:
bonniot
From: Daniel B. <bo...@us...> - 2004-09-02 16:49:09
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9213/web Modified Files: manual.xml Log Message: Updated "Using Nice from Java" section, now that most methods are compiled as instance methods. Index: manual.xml =================================================================== RCS file: /cvsroot/nice/Nice/web/manual.xml,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** manual.xml 27 Feb 2004 01:30:58 -0000 1.38 --- manual.xml 2 Sep 2004 16:48:58 -0000 1.39 *************** *** 1679,1691 **** </para> ! <section><title>Calling a method</title> <para> ! You can call a <link linkend="method">method</link> ! <literal>m</literal> ! defined in a nice package <literal>pkg</literal> by naming it <literal>pkg.dispatch.m</literal> in the Java program. ! It does not matter in what package(s) <literal>m</literal> ! is implemented: ! <literal>pkg</literal> must simply be the package where the method was declared. </para> --- 1679,1699 ---- </para> ! <section id="compilationMethods"><title>Calling a method</title> ! <para> ! For <link linkend="method">methods</link> declared inside a ! class, and for those declared at the package level and whose ! first argument is a Nice class, you can simply use them as ! usual in Java. ! </para> <para> ! This is not possible for methods declared at the package ! level and whose first argument is a Java class, a possibly ! null type or a primitive type. ! You can call a such a method <literal>m</literal> ! declared in a nice package <literal>pkg</literal> by naming it <literal>pkg.dispatch.m</literal> in the Java program. ! It does not matter in what package(s) <literal>m</literal> ! is implemented: ! <literal>pkg</literal> must simply be the package where the method was declared. </para> *************** *** 1721,1726 **** // A method: ! String display(); ! display() = "Person: " + name; } --- 1729,1733 ---- // A method: ! String display() = "Person: " + name; } *************** *** 1731,1735 **** display() = "Worker: " + name + " salary: " + salary; - // A method: boolean isRich() = salary > 500; } --- 1738,1741 ---- *************** *** 1750,1756 **** Worker w = new Worker("Julia", 1000); ! System.out.println(dispatch.display(p)); ! System.out.println(dispatch.display(w)); ! if (fun.isRich(w)) System.out.println("A well paid worker!"); } --- 1756,1762 ---- Worker w = new Worker("Julia", 1000); ! System.out.println(p.display()); ! System.out.println(w.display()); ! if (w.isRich()) System.out.println("A well paid worker!"); } *************** *** 1759,1763 **** </para> </example> ! </para></section> <section><title>Optional parameters</title> --- 1765,1770 ---- </para> </example> ! </para> ! </section> <section><title>Optional parameters</title> *************** *** 1780,1785 **** The constructor will need to call the <link linkend="constructorFromJava">parent constructor</link>. ! It is not possible to override a Nice multi-methods in a Java ! program. </para> </section> --- 1787,1796 ---- The constructor will need to call the <link linkend="constructorFromJava">parent constructor</link>. ! It is not fully possible to override a Nice multi-method in a Java ! program. However, provided that the method is compiled as an ! instance method, as specified <link ! linkend="compilationMethods">above</link>, you can override ! that method as usual for Java. That is, only the first ! (implicit) argument can be used to perform the override. </para> </section> |