Built-In Types

From The Elements Wiki
Jump to: navigation, search

This is an Oxygene Language topic
 

Oxygene Language: Intro | Structured Overview | Grammar | Keywords | Functions


In the following table, the first two columns lists the build-in types defined by the Oxygene and RemObjects C# languages.

These standard types (or type aliases) are defined in the virtual RemObjects.Elements.System (.NET and Cocoa) or com.remobjects.elements.system (Java) namespace. This namespace is in scope by default, so these type names can be referred to without namespace prefix (but the namespace prefix can be used to avoid ambiguities, in case other user-defined types interfere with the names).

RemObjects C# also uses select keywords (such as int as aliases for types).

Unless otherwise noted, all of these type names are available on all three platforms, .NET, Cocoa and Java.

The remaining three columns denote which types these names map to as .NET types, Java Language intrinsic type names and (Objective-)C language intrinsic types, respectively.


Oxygene
RemObjects C#
.NET Type
Java Type
Obj-C Type
Object Object System.Object java.lang.Object Foundation.NSObject
Byte byte System.Byte N/A u_int8_t
ShortInt sbyte System.SByte byte (!) int8_t
UInt16, Word UInt16, ushort System.UInt16 N/A uint16_t
SmallInt, Int16 Int16, short System.Int16 short int16_t
UInt32, Cardinal, LongWord UInt32, uint System.UInt32 N/A uint32_t
Integer, Int32 Int32, int System.Int32 int int32_t
UInt64 UInt64, uint64 System.UInt64 N/A uint64_t
Int64 Int64, int64 System.Int64 long int64_t
NativeInt (.NET & Cocoa) NativeInt System.IntPtr N/A NSInteger
NativeUInt (.NET & Cocoa) NativeUInt System.UIntPtr N/A NSUInteger
BigInteger (.NET) BigInteger System.Numerics.BigInteger N/A N/A
Single float System.Single float float
Double double System.Double double double
Extended, Real (Delphi compatibility) System.Double double double
Pointer *void ^System.Void N/A void *
Boolean bool System.Boolean bool BOOL
Char, WideChar char System.Char char unichar
String, WideString string System.String java.lang.String NSString

Literals

The default type of an Integer Literal is determined by the first type from the following list that can hold the number: Int32, UInt32, Int64, UInt64 and BigInteger (the latter currently limited to the .NET platform).

Notes for Cocoa

  • For Boxing purposes, integer types will be boxed into NSNumber<T> instances as needed, while preserving type safety and information about the concrete contained integer type.
  • Instance methods of the NSNumber class are available on all integer types, and the compiler will perform boxing as needed.
  • The rtl.* namespaces are in scope by default, but RemObjects.Elements.System has higher precedence, so the Oxygene and RemObjects C# type names are accessible by default.

Notes for Java

  • Java gained support for unsigned integer types in the July 2013 release of version 6. Note that unsigned types are not supported by the Java Language, so care should be taken when writing libraries or other code that will be consumed by Java Language developers.
  • For Boxing purposes, integer types will be boxed into the appropriate types from the java.lang namespace, e.g. nullable com.remobjects.elements.system.Boolean would be boxed into a java.lang.Boolean.
  • Instance methods of the boxing types defined in java.lang are available on all integer types, and the compiler will perform boxing as needed.
  • The java.lang namespace is in scope by default, but com.remobjects.elements.system has higher precedence, so the Oxygene and RemObjects C# type names are accessible by default.

See Also