User Tools

Site Tools


at:tutorial:symbiosis

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
at:tutorial:symbiosis [2007/07/05 09:47] jdedeckerat:tutorial:symbiosis [2007/07/05 10:00] jdedecker
Line 81: Line 81:
  
 def showSymbiosis() { def showSymbiosis() {
- def javaDemo := SymbiosisDemo.new();+  def javaDemo := SymbiosisDemo.new();
   
- def atObject := object: { +  def atObject := object: { 
- def ping() {  +    def ping() {  
-          system.println("ping!");  +      system.println("ping!");  
-          javaDemo.run2(self);  +      javaDemo.run2(self);  
-        }; +    }; 
- def pong() {  +    def pong() {  
-          system.println("pong!");  +      system.println("pong!");  
-          42  +      42  
-        +    
- };+  };
   
- javaDemo.run(atObject);+  javaDemo.run(atObject);
 }; };
  
Line 123: Line 123:
  
 If Java invokes a method declared in an interface with an overloaded method signature, all overloaded invocations are transformed into the same method invocation on the AmbientTalk object. In other words, the AmbientTalk object does not take the types into consideration. However, if the Java method is overloaded based on arity, the AmbientTalk programmer can take this into account in the parameter list of the corresponding AmbientTalk method, by means of a variable-argument list or optional parameters. Otherwise, the Java invocation may fail because of an arity mismatch. If Java invokes a method declared in an interface with an overloaded method signature, all overloaded invocations are transformed into the same method invocation on the AmbientTalk object. In other words, the AmbientTalk object does not take the types into consideration. However, if the Java method is overloaded based on arity, the AmbientTalk programmer can take this into account in the parameter list of the corresponding AmbientTalk method, by means of a variable-argument list or optional parameters. Otherwise, the Java invocation may fail because of an arity mismatch.
 +
 +<code>
 +>def test := /.at.tutorial.symbiosis
 +>><object:7974034>
 +>test.showSymbiosis()
 +ping!
 +pong!
 +>>42
 +</code>
at/tutorial/symbiosis.txt · Last modified: 2013/05/17 20:25 by tvcutsem