Skip to content

Instantly share code, notes, and snippets.

@Simn
Simn / ArrayRead.hx
Last active September 6, 2019 10:54 — forked from nadako/ArrayRead.hx
abstract ArrayRead<T>(Array<T>) from Array<T> {
@:arrayAccess inline function get(i:Int):T return this[i];
public var length(get,never):Int;
inline function get_length() return this.length;
}
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.Printer;
import haxe.macro.Type;
using haxe.macro.Tools;
// The original code used interfaces to define properties, and some interfaces
// had the same property name with different types. These interfaces are then
// implemented by classes that provide the implementation of those properties.