Source File Structure

From The Oxygene Language Wiki

Jump to:navigation, search

This is a Language topic
Feel free to add your notes to this topic below.



Every Delphi Prism project generates one assembly containing the classes implemented in the included source files.

A Delphi Prism source code file has a .pas extension and has the following basic Source file structure :

namespace

interface

implementation

end.

namespace replaces the 'unit' of classical Pascal, but the latter is supported for backward compatibility.

The same "namespace" name can be supplied to several source files in order to implement a common namespace.

The interface Section consists of declarations for one or more types and types such as classes and records can have multiple Class Members. Note: a Class is always restricted to a single namespace. Partial Classes allow you to split the definition of a single class between multiple source files.

The implementation Section contains the code for the methods declared in the interface.

Tiny Projects

Oxygene also supports "Tiny" projects. A tiny project is a project where there's no main class and main method, but just a simple begin/end at the end of the file. This will serve as the entry point of the project and lets you write short and simple applications quickly.

namespace MyApplication;

interface
uses
  System.Linq;

implementation

begin
  Console.WriteLine('The magic happens here.');
end.


See Also


Oxygene-48.png

Area: Oxygene Language
Compiler version: Oxygene 5

Language GlossaryKeywordsTypesFAQHow To

Navigation
Areas
More
Toolbox