Language

The new lang.Closeable interface and ARM blocks

at 2010-12-31 in LanguageExamples5.8-SERIES by friebe

The new lang.Closeable interface and the io.streams classes being retrofitted to implement it may not seem very useful on the first glance, although they serve the purpose of supporting the so-called ARM blocks. These are a feature supported by XP Language and reuse the try keyword:

  try ($expression[, $expression[, ...]]) {
// Statements
}

Any of the expressions are expected to be instanceof lang.Closeable and their close() methods are guaranteed to be called in the declaration order regardless of whether the block raises an exception or not.


(more)

XP language cheat sheet: Differences from PHP

at 2010-10-10 in Language by friebe

Now that we know the basics about the XP language - how to write a "hello world" application, how to compile and run it, and after looking at the underlying type system, and have seen both is quite similar to PHP - let's explore the differences, the object and concatenation operators, changed foreach, array and map syntaxes, the removed function keyword, as well as the now syntactically supported annotations, chaining, enumerations, varargs, and finally, the finally block.


(more)

The XP language's type system

at 2010-10-10 in Language by friebe

As promised in the first article of our XP language series, we will have a look at the type system. The XP language knows about the following types:

  • Primitives - The following primitives exist: int, float, string and bool
  • Reference types - Classes, interfaces and enums, e.g. lang.Object, util.log.Traceable and util.DateInterval
  • Arrays - An array is a zero-based and continuously numbered list of any type, e.g. string[] or util.Date[].
  • Maps - A map is a hashtable mapping string keys to any type, e.g. [:string] or [:lang.XPClass]
  • The variable type - Marks a type that may either be a primitive or any reference type, declared with the keyword "var". The compiler will not be able to verify type correctness in this case and will warn about this - checks will be deferred until runtime.
Member variables, method parameters and return types need to be typed, while local variables don't - their type will be inferred on initialization.


(more)

First steps with the XP Language

at 2010-09-24 in LanguageExamples by friebe

The XP language is not completely different from the way PHP works, it keeps the flexibility and the general "look and feel" while adding syntactical support for features PHP doesn't support or doesn't support in all versions the XP Framework runs on.

Like in the XP framework, the entry point is always a class. In their most simple form, these classes have a static main() method. An example:

  public class HelloWorld {
public
static void main(string[] $args) {
util.cmd.Console::writeLine
('Hello World from ', self::class.getName(), '!');
}
}
OK, this doesn't look too unfamiliar, does it?


(more)

Introducing: The next big thing

at 2010-09-24 in RFCsLanguage5.8-SERIES by friebe

If you have recently updated your SVN checkout, you may have seen a line like the following flying by:

U    devel/xp/trunk/rfc/0052.rfc.txt
RFC #0052? Wait? Wasn't that this really old idea about something with compilation and total world domination? Right - scroll up a couple of lines in that svn update output and find well-sounding names ranging from DeadCodeElimination, Operator and TypeInstance to DefaultDiagnosticListener.

Yes, we now have a compiler!

It's optional, yes, and it doesn't require any special PHP setup, .dll, .so, .bundle, configuration, or anything else to work. Just XP.

So, over the next time, we will provide a series of blog entries introducing the language, the compiler, optimizations, checks, the API. Stay tuned:-)



Subscribe

You can subscribe to the XP framework's news by using RSS syndication.


Categories

News
General
PHP5
Announcements
RFCs
Further reading
Examples
Editorial
EASC
Experiments
Unittests
Databases
5.8-SERIES
Unicode
Language
5.9-SERIES