HaxeShare (an OWEL replacement)

Okay, I’ve thought about the approach to use quite a lot for this project and have ultimately decided upon using more of a direct Haxe approach as you suggested, but not exactly in the way you describe.

I’ve called this new library HaxeShare which I would suggest is far easier to use than previously.


#if macro

import hxshare.Builder;

class Generator

    public static function build()

        Builder.addField("id", "ID");
        Builder.addField("shorttext", "URL");
        Builder.addField("shorttext", "Title", true);
        Builder.addField("longtext", "Description");;



Of course, all the build and setup instructions are on the main page on GitHub.

Original Post

I am curious why did you go with a custom format and then generate types from it with a macro, when you could just use a normal Haxe class or structure syntax and macro-generate the necessary support code directly from the type definition.

1 Like

Hmm… Well, I suppose I could, for example, implement typedef which Haxe at macro context could then generate the respective server class, but then there is also a number of metadata tags you might want to add to these variables to customise and define output.

However, there are customisation options I would like to add for language-specific targets.

Say, for example, you want to generate type references for WPF or WinForms on the C# target, or Swing on the Java target, or any other UI element for any other framework. The options are endless but having metadata stacked up on each other for these options is potentially messy. At least to me it looks messy.

With a custom format, it’s potentially easier to read to be able to define or even add extra Field Types for their relevant target-specific frameworks.

However, I suppose as this project grows we would have to wait and see if this is true in practice and how much of a benefit it might be to use metadata over a custom format.

EDIT: The custom format approach is for readability which I think is important for a project of this scale.

I have now added the following features to HaxeShare:

  1. A server-based router generated into a RESTful API.
  2. Added a hash-based client-side router class.

Please see updated project and documented README on GitHub for full details.

1 Like