Op Thu, 09 Oct 2008 23:08:46 +0200 schreef janko metelko <[EMAIL PROTECTED]>:

$exports.x = 33;
$exports.f = function(x) { return x * 2 + 1; }

This is all no problem to me, C and neko side works and all. But can you Nicolas or anybody else please show me what would the Haxe version of this small example be. A Haxe code that after compiled to .n exports some value x and some function f that calculates something. If such thing is possible?

haXe requires variables to be in classes, so the closest would be:

// ------------
// haXe
class Main {
  static var x = 33;
}

// ------------

// Neko output
$exports.Main.x = 33;
// ------------


Every haXe class is an object in Neko. So all statics are accessible in the exports.

That's why Nicolas wrote:

Op Thu, 09 Oct 2008 09:59:58 +0200 schreef Nicolas Cannasse <[EMAIL PROTECTED]>:

 $exports.my.package.MyClass
 (or the equivalent by using Neko API)
You can create an instance by calling MyClass.new(p1,p2,...) and the call the methods etc.


Kind regards,

        Danny Wilson

deCube - design and development

Mobile  [ 06 - 5232 1813
e-Mail  [ [EMAIL PROTECTED]
web URL [ http://www.decube.net/

--
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to