What's new in Oxygene 5 | RemObjects Software
Languages Platforms IDEs | Download Pricing |
The Oxygene Language. This is not your Daddy's Pascal.

More New Features

Oxygene 6.x

Oxygene 5.x

More Changes

Find information about more changes, including smaller enhancements not covered in our feature overview, and a complete list of all bug-fixes, in the detailed Change Logs.

In addition to our regular "feature" releases, new monthly interim releases with fixes, enhancements and sometimes minor features are made available on a semi-monthly schedule.

Language Evolution

Read more about the evolution of the Oxygene language, from version 1.0 all the way to its current release. More

What's new in Oxygene 5.0?

Oxygene 5 marks a major step in the evolution of the Oxygene language and development environment, with a completely redesigned compiler back-end and IDE integration that opens up the language for the next five – or more – rounds of innovation.

Java and Android

The biggest change in Oxygene 5 is certainly the new support for Java and Android. Oxygene 5 does not bring .NET and .NET-isms to Java, but instead brings over the Oxygene language that you know and love over to the Java platform, as a first class citizen. While remaining 99% code compatible, the language and compiler are designed to fit in well with the Java environment; you will write code against the existing Java or Android frameworks, and can make use of all the third party libraries and components available. Just like Oxygene for .NET directly reads .NET assemblies and outputs 100% pure .NET assemblies as a result, Oxygene for Java consumes standard .jar files and generates 100% pure Java .jar files (or Android .apk files).

The toolset is deeply integrated into the Visual Studio 2010 IDE, giving you the same development experience you are used to from Oxygene for .NET – including our state-of-the-art editor with Code Completion & Inline Error Reporting, and a full-fledged Java and Android debugger – while also fully integrating with the Java and Android tool chain, for example to package .apk files to deploy to your Android device right form the IDE.

Read more specifically about Oxygene for Java, here.

IDE Features

Oxygene 5 brings a range of new features to the IDE experience that will make your day-to-day development easier and more comfortable. These include:

  • New Enhanced Error Reporting provides you with information about compiler errors and warnings right inside the code editor. Colored markers will indicate error lines, and enhanced Error Ranges will narrow down exactly which part of the line is responsible for the error or warning. Additional Notes provide links to other parts of the projects that might help you solve your errors – such as the place a method you are trying to call was defined.

  • New Fix-It support lets you fix common errors in your code with a single click. If the compiler knows what's wrong - why not let it apply the fix for you? That's exactly what Fix-It does. Fix-It also contributes to Enhanced Error Recovery in the compiler, resulting in less "follow-up errors" from a single mistake in your code, and helping to accurately report real errors past the original error location. Fix-It is rounded off by the new Spell Checking support that automatically suggests the best alternatives for misspelled identifiers or keywords.

  • Oxidizer is now fully integrated into the IDE, letting you import not only C# but also Delphi code into your project, easily. Simply paste samples you found on the internet, or import whole C# or Delphi units, and Oxidizer will automatically adjust the syntax for you, getting you one steop closer to reusing the code in Oxygene.

But – a picture says more than a thousand words, so we have made a small video to show you these features in action:

We also have blog posts on Enhanced Error Reporting and Spell Checking.

Language Features

The big new thing for the Oxygene 5 language is of course that it now supports Java, as discussed above. Beyond that, we've also added two pretty significant new language features in this release:

Duck Typing and Soft Interfaces

Duck Typing lets you treat objects as if they implement interfaces they do not actually implement, as long as they provide the necessary methods to qualify for that interface – according to the motto that if it looks and quacks like a duck, you can treat it as if it were a duck.

For example, imagine you're consuming a class that implements Dispose, but does not specify the IDisposable interface in its ancestry list. With Duck Typing, you can use that class inside a using statement:

using duck(MyObject) do

Soft Interfaces complement Duck Typing by letting you define a custom interface that is compatible automatically with any type that qualifies for its members. Normally, when you define an interface, any class that you want to use with that interface has to explicitly implement the interface, by listing it in its ancestor list (and providing implementations for all its members, of course). But if you declare an interface with the extra soft keyword, any object that has the necessary members will automatically qualify!

For example, several simple types in the .NET framework provide an overloaded ToString() method that takes an optional string with formatting options. But since Int32 and Double share no common ancestor beyond System.Object, you cannot really write code that uses the types interchangeably to call ToString(format: String) on them. But what of you can define a soft interface like this:

type
  IStringFormatter = soft interface
    method ToString(format: String): string;
  end;

Now, both Int32 and Double (as well as many other types, such as Guid) conform to this IStringFormatter soft interface. You could declare a method such as:

method PrintPretty(value: IStringFormatter; format: string);

and pass all kinds of different types to it. The method would not care if it received an Int32 or Double – it would just know that it can call ToString(format: String) on the object it received.

Inline Interface Implementations

Inline Interface Implementations are a feature that has been added to the Oxygene language from Java – in part to make Oxgene a good citizen on the Java platform – but are available on .NET as well.

The Java platform does not use multicast events like .NET, but instead employs the more traditional delegate model, also found in Objective-C. Classes that fire events or have callbacks usually come with a companion delegate interface that defines any methods that the class wants to call back on.

Of course, implementing an interface in Oxygene is easy, but with the nature of events and callbacks, one might not always want to implement the delegate interface on the main object, and creating helper objects to provide delegates can become tedious and unwieldy as well, especially if you want to access state in your main object from the helper – which is common for event handlers.

With Oxygene 5, it is now possible to implement interfaces inline within a method body of your class, similar to how individual anonymous methods already work. Say we have a fictitious Button class that requires an IButtonDelegate interface for callbacks. We could provide this delegate as such:

begin
  var b := new Button;
  var lCaptionWhenClicked := 'You clicked me!';
  b.Events := new interface IButtonDelegate(OnClick := method(b2: Button) 
                                                       begin 
                                                         b2.Caption := lCaptionWhenClicked; 
                                                       end, 
                                            OnGetHoverHint := b2 -> 'Button '+b2.Caption);
end.

In essence, this declares a new anonymous class that provides implementation for the two OnClick and OngetHoverHint methods; just like with anonymous methods (or closures), from within the class, we have full access to the surrounding scope, including any local variables or our main object's members.

Read More

There are also two blog posts on Duck Typing and Inline Interfaces that go into more detail on these topics.

Love the idea of Oxygene, but prefer a different language?
Check out RemObjects C#, Swift or Iodine (Java)!