![]() |
|
| Developer | RemObjects Software |
|---|---|
| Latest release | 3.0.13/ 29 August 2008 |
| Influenced by | Object Pascal |
| OS | Common Language Infrastructure |
| License | Commercial |
| Website | Oxygene Homepage |
Oxygene (formerly known as Chrome) is a programming language developed by RemObjects Software for the Common Language Infrastructure. Oxygene is Object Pascal-based.
Compared to Delphi.NET, now owned by Embarcadero, Oxygene does not emphasize total backward compatibility.
RemObjects Software offers full integration into Visual Studio 2003/2005/2008. There is no stand-alone Oxygene IDE.
Contents |
Features
- CLI integration.
- Based on Object Pascal, with addition of many new language features.
- Support for "class contracts", an assertion mechanism similar to design by contract.
- Inline variable declaration.
- Anonymous types.
- Anonymous methods and delegates.
- Asynchronous methods.
- Lambda expressions.
- .NET 2.0 support.
- Generics. (.NET 2.0 only)
- Nullable types. (.NET 2.0 only)
- Iterators.
- Partial classes (for .NET 1.1 and 2.0)
- Extension methods.
- Support for LINQ.
- Type inference.
- Virtual properties and events.
- Enhanced multicast events.
- Inline variable initializers.
- Enhanced for loops.
- Colon operator for nil-safe work.
- Support for WPF.
- Full support for alternative frameworks from within Visual Studio (see Portable.NET and Mono development platform)
Code examples
Hello World
namespace HelloWorld; interface type HelloClass = class public class method Main; end; implementation class method HelloClass.Main; begin System.Console.WriteLine('Hello World!'); end; end.
Generic container
namespace GenericContainer; interface type TestApp = class public class method Main; end; Person = class public property FirstName: String; property LastName: String; end; implementation uses System.Collections.Generic; class method TestApp.Main; begin var myList := new List<Person>; //type inference myList.Add(new Person(FirstName := 'John', LastName := 'Doe')); myList.Add(new Person(FirstName := 'Jane', LastName := 'Doe')); myList.Add(new Person(FirstName := 'James', LastName := 'Doe')); Console.WriteLine(myList[1].FirstName); //No casting needed Console.ReadLine; end; end.
Generic method
namespace GenericMethodTest; interface type GenericMethodTest = static class public class method Main; private class method Swap<T>(var left, right : T); class method DoSwap<T>(left, right : T); end; implementation class method GenericMethodTest.DoSwap<T>(left, right : T); begin var a := left; var b := right; Console.WriteLine('Type: {0}', typeof(T)); Console.WriteLine('-> a = {0}, b = {1}', a , b); Swap<T>(var a, var b); Console.WriteLine('-> a = {0}, b = {1}', a , b); end; class method GenericMethodTest.Main; begin var a := 23;// type inference var b := 15; DoSwap<Integer>(a, b); // no downcasting to Object in this method. var aa := 'abc';// type inference var bb := 'def'; DoSwap<String>(aa, bb); // no downcasting to Object in this method. DoSwap(1.1, 1.2); // type inference for generic parameters Console.ReadLine(); end; class method GenericMethodTest.Swap<T>(var left, right : T); begin var temp := left; left:= right; right := temp; end; end.
Program Output:
Type: System.Int32 -> a = 23, b = 15 -> a = 15, b = 23 Type: System.String -> a = abc, b = def -> a = def, b = abc Type: System.Double -> a = 1,1, b = 1,2 -> a = 1,2, b = 1,1
Enhanced case statements
case aClassID.ToUpper of 'XYZ': result := TMyXYZClass; 'ABC': result := TMyOtherClass; else raise new Exception('Invalid Class ID'); end;
case aClass type of TMyXYZClass: TMyXYZClass(aClass).DoSomething; TMyOtherClass: TMyOtherClass(aClass).DoSomethingElse; else raise new Exception('Invalid Class Reference'); end;
See also
- C Sharp (programming language)
- Delphi programming language
- Free Pascal
- Eiffel (programming language)
- Hello world program
- Java (programming language)
External links
|
|||||||||||||||||||||||||||||||
No comments have been added.






