Warning
These guidelines haven't been updated since 2016. Learn more…
Table of contents
#!/usr/bin/env haxex -lib mcli @ | |
/** | |
Taken from mcli example https://github.com/waneck/mcli | |
Say hello. | |
Example inspired by ruby's "executable" lib example | |
**/ | |
class HaxeScript extends mcli.CommandLine | |
{ | |
/** |
class KeyValueIterator<K,V> { | |
var map:Map<K,V>; | |
var keys:Iterator<K>; | |
static public inline function pairs<K,V>(map:Map<K,V>) return new KeyValueIterator(map); | |
public inline function new(map:Map<K,V>) { | |
this.map = map; | |
this.keys = map.keys(); | |
} |
package ; | |
import haxe.macro.Type; | |
import haxe.macro.Expr; | |
import haxe.macro.Context; | |
import haxe.macro.Compiler; | |
using haxe.macro.ExprTools; | |
class Macro { |
import haxe.ds.Either; | |
abstract OneOf<A, B>(Either<A, B>) from Either<A, B> to Either<A, B> { | |
@:from inline static function fromA<A, B>(a:A) : OneOf<A, B> return Left(a); | |
@:from inline static function fromB<A, B>(b:B) : OneOf<A, B> return Right(b); | |
@:to inline function toA():Null<A> return switch(this) {case Left(a): a; default: null;} | |
@:to inline function toB():Null<B> return switch(this) {case Right(b): b; default: null;} | |
} |
package ; | |
#if macro | |
import haxe.macro.Context; | |
import haxe.macro.Printer; | |
import haxe.macro.Expr; | |
class MacroEnum { | |
macro public static function buildToString():Array<Field> { |
class MainTest { | |
static public function main() { | |
trace("Hello world!"); | |
trace('Fibonacci of 7 is: ${fibonacci(7)}'); | |
} | |
static function fibonacci(n) { | |
if (n == 0) return 0; | |
else if (n == 1) return 1; |
Warning
These guidelines haven't been updated since 2016. Learn more…
Table of contents
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.Type; | |
using Lambda; | |
/** | |
Old school abstract class. | |
Classes that implements it, and their sub-classes, will be able to declare abstract methods (methods that without body). | |
There will be a check in compile-time such that no public constructor is allowed without all abstract methods implemented. | |
*/ |
#============================================================== | |
# .picasa.ini FILE STRUCTURE | |
# | |
# reverse-engineered by Franz Buchinger <[email protected]> | |
# licensed to the public domain | |
# | |
# Picasa Version(s): 3.8.0 | |
# | |
# Changelog: | |
# v0.1: initial release |