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 [2008/10/22 18:32] – * tvcutsemat:tutorial:symbiosis [2009/01/26 16:54] – comment elisag
Line 11: Line 11:
 When AmbientTalk values and Java values cross language boundaries (e.g. when they are passed as arguments of or return values from a method that is invoked from the other language), these values are converted. AmbientTalk features a number of built-in conversions that maps AmbientTalk's native language values onto JVM native data types and vice versa. The following tables show the conversion rules for going from Java to AmbientTalk and from AmbientTalk to Java. When AmbientTalk values and Java values cross language boundaries (e.g. when they are passed as arguments of or return values from a method that is invoked from the other language), these values are converted. AmbientTalk features a number of built-in conversions that maps AmbientTalk's native language values onto JVM native data types and vice versa. The following tables show the conversion rules for going from Java to AmbientTalk and from AmbientTalk to Java.
  
-^ Java type and value ^ AmbientTalk value ^+^ Java value : type ^ AmbientTalk value ^
 | null: Object | nil | | null: Object | nil |
 | n: int | a number n | | n: int | a number n |
Line 33: Line 33:
 | a class wrapper( c ) | c : Class | | a class wrapper( c ) | c : Class |
 | a java wrapper(obj : Type) | obj : Type | | a java wrapper(obj : Type) | obj : Type |
-| any object o | AT wrapper (o) : Interface |+| any object o | AT wrapper (o) : |
  
 Note that non-native Java or AmbientTalk objects are represented in the other language by means of "wrappers". The task of these "wrappers" is to represent an object written in one language to act as if it were an object written directly in the other language. Note that non-native Java or AmbientTalk objects are represented in the other language by means of "wrappers". The task of these "wrappers" is to represent an object written in one language to act as if it were an object written directly in the other language.
 +
 +In the last conversion rule of the second table, ''I'' represents a Java interface type. ''I'' is determined by a static type declaration in Java.
  
 ===== Accessing Java from within AmbientTalk ===== ===== Accessing Java from within AmbientTalk =====
Line 49: Line 51:
  
 A class is represented as a normal AmbientTalk object. All ''public static'' methods defined on the class can be invoked like normal methods on its "wrapped" object representation. A class is represented as a normal AmbientTalk object. All ''public static'' methods defined on the class can be invoked like normal methods on its "wrapped" object representation.
 +
 +<note>
 +If you want to load your own Java class make sure that the .class file is in the classpath of the JVM running AmbientTalk. By default, the iat script puts the at/ directory of the AmbientTalk distribution in the classpath. 
 +</note>
  
 ==== Creating Java objects ==== ==== Creating Java objects ====
at/tutorial/symbiosis.txt · Last modified: 2013/05/17 20:25 by tvcutsem