Platform Specific Mappings
All Languages
Interfaces with a single method
When Elements encounters an interface without ancestor interfaces and with a single method, it's treated as a delegate, making it possible to assign anonymous methods, method pointers and lambdas to it.
.NET
Tuples
The Oxygene and Swift Tuple types are mapped to System.Tuple<>
ISequence<T>
The ISequence<T> maps to System.Collections.Generic.IEnumerable<T>.
Java
Tuples
The Oxygene/Silver tuple types are mapped to com.remobjects.elements.system.Tuple*.
ISequence<T>
The ISequence<T> maps to System.Collections.Generic.IEnumerable<T>.
Properties
Java does not natively have the concept of properties, when Elements encounters a get/set pair with matching name and type they're treated as a property. See Property Matching
Cocoa
Tuples
The Oxygene/Silver tuple types are mapped to RemObjects.Elements.System.Tuple*.
ISequence<T>
The ISequence<T> maps to RemObjects.Elements.System.INSFastEnumeration<T>.
Properties
Cocoa does not have the concept of static properties, when Elements encounters a static get/set pair with matching name and type they're treated as a property. See Property Matching
Property Matching
Java has no built in property support but instead uses conventions, while Cocoa does support properties but only on class instances, not static ones. When the compiler here finds a matching pair it turns them into a property.
For example on Java:
class MyClass
{
void setValue(String s);
String getValue();
}
becomes accessible as a read/write instance property on the class instance.Value. Java uses a convention of "get" and "set" methods, followed by a capital letter. Cocoa uses a selector with just the property name as the getter, and setPropertyName for properties:
+(void)setValue(NSString* val);
+(NSString)value();
Like above becomes a property called Value.
Note: The original get and set methods can still be called, the property accessor is just an easier way to use this class.
When the getter or setter has more parameters they are matched and become an "indexer" property:
class Bundle
{
void setString(String key, string value);
String getString(string key);
}
This can be accessed as a read/write indexer property: instance.String["key"].