Oxidizer

Elements includes Oxidizer, a powerful tool that can convert code from C#, Java, Objective-C and Delphi code to Oxygene, C#, Swift, Java and Go. This makes it easy to reuse code snippets or even whole classes found online, or to convert pieces of code from an existing project to Elements.

Oxidizer is integrated into the IDEs and can be invoked in one of two ways:

  • The Paste As feature lets you paste code from your clipboard straight into your current code file, and converts it on the fly.
  • The Import feature lets you select one or more code files from disk and import them into your project as new files, translating them in the process.

For platform-specific code written in C# (for .NET), the Java language (for, well, Java), and Objective-C (for Cocoa), chances are the converted code will work right away, as Elements of course uses the exact same classes and APIs as those languages, on the respective platform.

Note that Oxidizing from Swift will not "undo" Swifty-fied API names on the Cocoa platform to their proper Objective-C level names, since Oxidizer processes only the language syntax.

However, Oxidizer can also be useful for converting code between different platforms. For example, you might have an algorithm implemented in Java and want to use that in your .NET project. Using "Paste Java as Oxygene" will convert the algorithm into proper Oxygene code, you just might have to replace any Java-platform-specific APIs the code used with their .NET, Cocoa or Sugar equivalent to use that same code on different platforms.

Oxidizer is also useful for migrating Delphi code to Oxygene. As in the previous example, Oxidizer will not magically get rid of the Delphi RTL or VCL APIs your code uses, but it will adjust the core language syntax for the differences between Delphi and Oxygene.

Supported Conversions

Oxidizer does not currently support converting from and to all language combinations. In particular, Delphi code can only be converted to Oxygene, and conversion from Go is not available. Also note that conversion to Go is severely limited, since many core constructs of the other langages (such as even Classes) cannot be expressed in Go.

The following conversions are supported:

↓ From / To → Oxygene C# Swift Java Go
Oxygene
-
C#
-
Swift
-
Java
-
Go
-
Delphi
C
Objective-C

Reporting Conversion Issues

While Oxidizer's support is extensive, it is always possible that there will be some code constructs it does not handle yet. If you encounter any problems, we would appreciate bug reports: simply paste the original code (and ideally the wrong result produced by Oxidizer) into an email and send it to support@remobjects.com or post a bug report on Talk.